Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (239451 => 239452)
--- trunk/Source/WebInspectorUI/ChangeLog 2018-12-20 18:27:46 UTC (rev 239451)
+++ trunk/Source/WebInspectorUI/ChangeLog 2018-12-20 18:29:45 UTC (rev 239452)
@@ -1,5 +1,22 @@
2018-12-20 Devin Rousso <[email protected]>
+ Web Inspector: UIString should take an optional key and description to aid localization
+ https://bugs.webkit.org/show_bug.cgi?id=153962
+ <rdar://problem/24542505>
+
+ Reviewed by Brian Burg.
+
+ * UserInterface/Base/LoadLocalizedStrings.js:
+ (WI.UIString):
+
+ * UserInterface/Test/Test.js:
+ (WI.UIString):
+
+ * UserInterface/Views/AuditTestGroupContentView.js:
+ (WI.AuditTestGroupContentView.prototype.initialLayout):
+
+2018-12-20 Devin Rousso <[email protected]>
+
Web Inspector: Audits: don't cache default audits
https://bugs.webkit.org/show_bug.cgi?id=192918
<rdar://problem/46626543>
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (239451 => 239452)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2018-12-20 18:27:46 UTC (rev 239451)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2018-12-20 18:29:45 UTC (rev 239452)
@@ -56,7 +56,6 @@
localizedStrings["%s delay"] = "%s delay";
localizedStrings["%s eval\n%s async"] = "%s eval\n%s async";
localizedStrings["%s interval"] = "%s interval";
-localizedStrings["%s%%"] = "%s%%";
localizedStrings["(Action %s)"] = "(Action %s)";
localizedStrings["(Disk)"] = "(Disk)";
localizedStrings["(Index)"] = "(Index)";
@@ -672,6 +671,8 @@
localizedStrings["Pause Processing"] = "Pause Processing";
localizedStrings["Pause Reason"] = "Pause Reason";
localizedStrings["Pause script execution (%s or %s)"] = "Pause script execution (%s or %s)";
+/* The number of tests that passed expressed as a percentage, followed by a literal %. */
+localizedStrings["Percentage (of audits)"] = "%s%%";
localizedStrings["Ping"] = "Ping";
localizedStrings["Ping Frame"] = "Ping Frame";
localizedStrings["Pings"] = "Pings";
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js (239451 => 239452)
--- trunk/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js 2018-12-20 18:27:46 UTC (rev 239451)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js 2018-12-20 18:29:45 UTC (rev 239452)
@@ -41,23 +41,25 @@
return string;
};
-WI.UIString = function(string)
+WI.UIString = function(string, key, comment)
{
if (WI.dontLocalizeUserInterface)
return string;
- if (window.localizedStrings && string in window.localizedStrings)
- return window.localizedStrings[string];
+ key = key || string;
+ if (window.localizedStrings && key in window.localizedStrings)
+ return window.localizedStrings[key];
+
if (!window.localizedStrings)
- console.error(`Attempted to load localized string "${string}" before localizedStrings was initialized.`);
+ console.error(`Attempted to load localized string "${key}" before localizedStrings was initialized.`, comment);
if (!this._missingLocalizedStrings)
this._missingLocalizedStrings = {};
- if (!(string in this._missingLocalizedStrings)) {
- console.error("Localized string \"" + string + "\" was not found.");
- this._missingLocalizedStrings[string] = true;
+ if (!(key in this._missingLocalizedStrings)) {
+ console.error(`Localized string "${key}" was not found.`, comment);
+ this._missingLocalizedStrings[key] = true;
}
return "LOCALIZED STRING NOT FOUND";
Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (239451 => 239452)
--- trunk/Source/WebInspectorUI/UserInterface/Test/Test.js 2018-12-20 18:27:46 UTC (rev 239451)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/Test.js 2018-12-20 18:29:45 UTC (rev 239452)
@@ -165,7 +165,7 @@
WI.isDebugUIEnabled = () => false;
WI.unlocalizedString = (string) => string;
-WI.UIString = (string) => string;
+WI.UIString = (string, key, comment) => string;
WI.indentString = () => " ";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/AuditTestGroupContentView.js (239451 => 239452)
--- trunk/Source/WebInspectorUI/UserInterface/Views/AuditTestGroupContentView.js 2018-12-20 18:27:46 UTC (rev 239451)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/AuditTestGroupContentView.js 2018-12-20 18:29:45 UTC (rev 239452)
@@ -65,7 +65,8 @@
this._percentageTextElement = document.createElement("span");
- String.format(WI.UIString("%s%%"), [this._percentageTextElement], String.standardFormatters, this._percentageContainer, (a, b) => {
+ const format = WI.UIString("%s%%", "Percentage (of audits)", "The number of tests that passed expressed as a percentage, followed by a literal %.");
+ String.format(format, [this._percentageTextElement], String.standardFormatters, this._percentageContainer, (a, b) => {
a.append(b);
return a;
});
Modified: trunk/Tools/ChangeLog (239451 => 239452)
--- trunk/Tools/ChangeLog 2018-12-20 18:27:46 UTC (rev 239451)
+++ trunk/Tools/ChangeLog 2018-12-20 18:29:45 UTC (rev 239452)
@@ -1,3 +1,13 @@
+2018-12-20 Devin Rousso <[email protected]>
+
+ Web Inspector: UIString should take an optional key and description to aid localization
+ https://bugs.webkit.org/show_bug.cgi?id=153962
+ <rdar://problem/24542505>
+
+ Reviewed by Brian Burg.
+
+ * Scripts/extract-localizable-js-strings:
+
2018-12-20 Tim Horton <[email protected]>
Unparented WKWebView can't retrieve main resource data for a main frame plugin
Modified: trunk/Tools/Scripts/extract-localizable-js-strings (239451 => 239452)
--- trunk/Tools/Scripts/extract-localizable-js-strings 2018-12-20 18:27:46 UTC (rev 239451)
+++ trunk/Tools/Scripts/extract-localizable-js-strings 2018-12-20 18:29:45 UTC (rev 239452)
@@ -74,7 +74,7 @@
chomp;
# Handle WebInspector strings. Prints a warning if a non-string literal is passed to WI.UIString().
- HandleUIString($1, $1, "", $file, $.) while s/WI\.UIString\("([^"]+)"\)//;
+ HandleUIString($1, $2 || $1, $3 || "", $file, $.) while s/WI\.UIString\("([^"]+)"(?:,\s*"([^"]+)"(?:,\s*"([^"]+)")?)?\)//;
print "$file:$.:WARNING: $&\n" while s/WI\.UIString\(.*?\)//;
# Handle strings for other projects that also use this script.
@@ -151,6 +151,7 @@
my $localizedStrings = "var localizedStrings = new Object;\n\n";
for my $key (sort keys %commentByKey) {
+ $localizedStrings .= "/* $commentByKey{$key} */\n" if length $commentByKey{$key};
$localizedStrings .= "localizedStrings[\"$key\"] = \"$stringByKey{$key}\";\n";
}