Changeset 214841 in webkit


Ignore:
Timestamp:
Apr 3, 2017 3:06:24 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: "Space" is not localizable in Timelines record button tooltips
https://bugs.webkit.org/show_bug.cgi?id=170420
<rdar://problem/30871371>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2017-04-03
Reviewed by Timothy Hatcher.

  • UserInterface/Base/LoadLocalizedStrings.js:

(WebInspector.unlocalizedString):
(WebInspector.UIString):

  • UserInterface/Base/Main.js:

Move UIString / unlocalizedString to LoadLocalizedString.js.
They may be needed before Main.js has introduced it.

  • UserInterface/Test/Test.js:

Provide a default implementaiton of unlocalizedString.

  • Localizations/en.lproj/localizedStrings.js:
  • UserInterface/Models/KeyboardShortcut.js:

Most keys use a symbol to represent the key. "Space" was the one
exception, so use a localized string.

Location:
trunk/Source/WebInspectorUI
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r214840 r214841  
     12017-04-03  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: "Space" is not localizable in Timelines record button tooltips
     4        https://bugs.webkit.org/show_bug.cgi?id=170420
     5        <rdar://problem/30871371>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Base/LoadLocalizedStrings.js:
     10        (WebInspector.unlocalizedString):
     11        (WebInspector.UIString):
     12        * UserInterface/Base/Main.js:
     13        Move UIString / unlocalizedString to LoadLocalizedString.js.
     14        They may be needed before Main.js has introduced it.
     15
     16        * UserInterface/Test/Test.js:
     17        Provide a default implementaiton of unlocalizedString.
     18
     19        * Localizations/en.lproj/localizedStrings.js:
     20        * UserInterface/Models/KeyboardShortcut.js:
     21        Most keys use a symbol to represent the key. "Space" was the one
     22        exception, so use a localized string.
     23
    1242017-04-03  Joseph Pecoraro  <pecoraro@apple.com>
    225
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r214840 r214841  
    768768localizedStrings["Source"] = "Source";
    769769localizedStrings["Sources"] = "Sources";
     770localizedStrings["Space"] = "Space";
    770771localizedStrings["Spaces"] = "Spaces";
    771772localizedStrings["Spacing"] = "Spacing";
  • trunk/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js

    r164543 r214841  
    3333        document.write("<script src=\"" + localizedStringsURL + "\"></script>");
    3434})();
     35
     36WebInspector.unlocalizedString = function(string)
     37{
     38    // Intentionally do nothing, since this is for engineering builds
     39    // (such as in Debug UI) or in text that is standardized in English.
     40    // For example, CSS property names and values are never localized.
     41    return string;
     42};
     43
     44WebInspector.UIString = function(string, vararg)
     45{
     46    if (WebInspector.dontLocalizeUserInterface)
     47        return string;
     48
     49    if (window.localizedStrings && string in window.localizedStrings)
     50        return window.localizedStrings[string];
     51
     52    if (!this._missingLocalizedStrings)
     53        this._missingLocalizedStrings = {};
     54
     55    if (!(string in this._missingLocalizedStrings)) {
     56        console.error("Localized string \"" + string + "\" was not found.");
     57        this._missingLocalizedStrings[string] = true;
     58    }
     59
     60    return "LOCALIZED STRING NOT FOUND";
     61};
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r214494 r214841  
    10651065};
    10661066
    1067 WebInspector.unlocalizedString = function(string)
    1068 {
    1069     // Intentionally do nothing, since this is for engineering builds
    1070     // (such as in Debug UI) or in text that is standardized in English.
    1071     // For example, CSS property names and values are never localized.
    1072     return string;
    1073 };
    1074 
    1075 WebInspector.UIString = function(string, vararg)
    1076 {
    1077     if (WebInspector.dontLocalizeUserInterface)
    1078         return string;
    1079 
    1080     if (window.localizedStrings && string in window.localizedStrings)
    1081         return window.localizedStrings[string];
    1082 
    1083     if (!this._missingLocalizedStrings)
    1084         this._missingLocalizedStrings = {};
    1085 
    1086     if (!(string in this._missingLocalizedStrings)) {
    1087         console.error("Localized string \"" + string + "\" was not found.");
    1088         this._missingLocalizedStrings[string] = true;
    1089     }
    1090 
    1091     return "LOCALIZED STRING NOT FOUND";
    1092 };
    1093 
    10941067WebInspector.indentString = function()
    10951068{
  • trunk/Source/WebInspectorUI/UserInterface/Models/KeyboardShortcut.js

    r184974 r214841  
    233233    Enter: new WebInspector.Key(13, "\u21a9"),
    234234    Escape: new WebInspector.Key(27, "\u238b"),
    235     Space: new WebInspector.Key(32, "Space"),
     235    Space: new WebInspector.Key(32, WebInspector.UIString("Space")),
    236236    PageUp: new WebInspector.Key(33, "\u21de"),
    237237    PageDown: new WebInspector.Key(34, "\u21df"),
  • trunk/Source/WebInspectorUI/UserInterface/Test/Test.js

    r213626 r214841  
    103103WebInspector.isDebugUIEnabled = () => false;
    104104
     105WebInspector.unlocalizedString = (string) => string;
    105106WebInspector.UIString = (string) => string;
    106107
Note: See TracChangeset for help on using the changeset viewer.