@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Translate differential-dropdown-menus

Summary: This is a simpler version of D5649.

Test Plan: Switched to ALL CAPS translation and clicked View Options.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1139

Differential Revision: https://secure.phabricator.com/D5759

+55 -11
+20
src/infrastructure/javelin/Javelin.php
··· 1 1 <?php 2 2 3 3 final class Javelin { 4 + 4 5 public static function initBehavior($behavior, array $config = array()) { 6 + switch ($behavior) { 7 + case 'differential-dropdown-menus': 8 + $config['pht'] = array( 9 + 'Open in Editor' => pht('Open in Editor'), 10 + 'Show Entire File' => pht('Show Entire File'), 11 + 'Entire File Shown' => pht('Entire File Shown'), 12 + "Can't Toggle Unloaded File" => pht("Can't Toggle Unloaded File"), 13 + 'Expand File' => pht('Expand File'), 14 + 'Collapse File' => pht('Collapse File'), 15 + 'Browse in Diffusion' => pht('Browse in Diffusion'), 16 + 'View Standalone' => pht('View Standalone'), 17 + 'Show Raw File (Left)' => pht('Show Raw File (Left)'), 18 + 'Show Raw File (Right)' => pht('Show Raw File (Right)'), 19 + 'Configure Editor' => pht('Configure Editor'), 20 + ); 21 + break; 22 + } 23 + 5 24 $response = CelerityAPI::getStaticResourceResponse(); 6 25 $response->initBehavior($behavior, $config); 7 26 } 27 + 8 28 }
+21
webroot/rsrc/js/application/core/phtize.js
··· 1 + /** 2 + * @provides phabricator-phtize 3 + * @requires javelin-util 4 + * @javelin 5 + */ 6 + 7 + JX.phtize = function(config) { 8 + 9 + return function(text) { 10 + if (!(text in config)) { 11 + if (__DEV__) { 12 + JX.$E('pht("' + text + '"): translation was not configured.'); 13 + } 14 + 15 + return text; 16 + } 17 + 18 + return config[text]; 19 + }; 20 + 21 + };
+14 -11
webroot/rsrc/js/application/differential/behavior-dropdown-menus.js
··· 6 6 * javelin-stratcom 7 7 * phabricator-dropdown-menu 8 8 * phabricator-menu-item 9 + * phabricator-phtize 9 10 */ 10 11 11 12 JX.behavior('differential-dropdown-menus', function(config) { 13 + 14 + var pht = JX.phtize(config.pht); 12 15 13 16 function show_more(container) { 14 17 var nodes = JX.DOM.scry(container, 'tr', 'context-target'); ··· 46 49 if (data.diffusionURI) { 47 50 // Show this only if we have a link, since when this appears in Diffusion 48 51 // it is otherwise potentially confusing. 49 - diffusion_item = link_to('Browse in Diffusion', data.diffusionURI); 52 + diffusion_item = link_to(pht('Browse in Diffusion'), data.diffusionURI); 50 53 } 51 54 52 55 var menu = new JX.PhabricatorDropdownMenu(buttons[ii]) ··· 63 66 menu.addItem(diffusion_item); 64 67 } 65 68 66 - menu.addItem(link_to('View Standalone', data.standaloneURI)); 69 + menu.addItem(link_to(pht('View Standalone'), data.standaloneURI)); 67 70 68 71 if (data.leftURI) { 69 - menu.addItem(link_to('Show Raw File (Left)', data.leftURI)); 72 + menu.addItem(link_to(pht('Show Raw File (Left)'), data.leftURI)); 70 73 } 71 74 72 75 if (data.rightURI) { 73 - menu.addItem(link_to('Show Raw File (Right)', data.rightURI)); 76 + menu.addItem(link_to(pht('Show Raw File (Right)'), data.rightURI)); 74 77 } 75 78 76 79 if (data.editor) { 77 80 menu.addItem(new JX.PhabricatorMenuItem( 78 - 'Open in Editor', 81 + pht('Open in Editor'), 79 82 JX.bind(null, location.assign, data.editor), // Open in the same window. 80 83 data.editor)); 81 84 } 82 85 83 86 if (data.editorConfigure) { 84 - menu.addItem(link_to('Configure Editor', data.editorConfigure)); 87 + menu.addItem(link_to(pht('Configure Editor'), data.editorConfigure)); 85 88 } 86 89 87 90 menu.listen( ··· 95 98 var nodes = JX.DOM.scry(JX.$(data.containerID), 'a', 'show-more'); 96 99 if (nodes.length) { 97 100 reveal_item.setDisabled(false); 98 - reveal_item.setName('Show Entire File'); 101 + reveal_item.setName(pht('Show Entire File')); 99 102 } else { 100 103 reveal_item.setDisabled(true); 101 - reveal_item.setName('Entire File Shown'); 104 + reveal_item.setName(pht('Entire File Shown')); 102 105 } 103 106 104 107 visible_item.setDisabled(true); 105 - visible_item.setName("Can't Toggle Unloaded File"); 108 + visible_item.setName(pht("Can't Toggle Unloaded File")); 106 109 var diffs = JX.DOM.scry(JX.$(data.containerID), 107 110 'table', 'differential-diff'); 108 111 if (diffs.length > 1) { ··· 113 116 diff = diffs[0]; 114 117 visible_item.setDisabled(false); 115 118 if (JX.Stratcom.getData(diff).hidden) { 116 - visible_item.setName('Expand File'); 119 + visible_item.setName(pht('Expand File')); 117 120 } else { 118 - visible_item.setName('Collapse File'); 121 + visible_item.setName(pht('Collapse File')); 119 122 } 120 123 } else { 121 124 // Do nothing when there is no diff shown in the table. For example,