WebKit Bugzilla
Attachment 357764 Details for
Bug 153962
: Web Inspector: UIString should take an optional key and description to aid localization
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-153962-20181219181611.patch (text/plain), 5.03 KB, created by
Devin Rousso
on 2018-12-19 17:16:12 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2018-12-19 17:16:12 PST
Size:
5.03 KB
patch
obsolete
>diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 2dfd7f584140c210acd57003a3df8c5c224d3f40..335a9328813dc23fcc2e8616484cc4445a190689 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,17 @@ >+2018-12-19 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: WebInspector.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 NOBODY (OOPS!). >+ >+ * UserInterface/Base/LoadLocalizedStrings.js: >+ (WI.UIString): >+ >+ * UserInterface/Test/Test.js: >+ (WI.UIString): >+ > 2018-12-19 Nikita Vasilyev <nvasilyev@apple.com> > > Web Inspector: Computed: make UI more usable when the panel is narrow >diff --git a/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js b/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js >index f0fd8cd6ea0acf6ec516a7a6d765d31f75b411b2..c0f5a375e33dd076ac70aa8901497dddeef4577f 100644 >--- a/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js >+++ b/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js >@@ -41,23 +41,25 @@ WI.unlocalizedString = function(string) > 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"; >diff --git a/Source/WebInspectorUI/UserInterface/Test/Test.js b/Source/WebInspectorUI/UserInterface/Test/Test.js >index 7f6c726ffd32ec286f12709d64c57dec9aa61d3d..f8adde814a31199222b807081ba3dacaeb27b5de 100644 >--- a/Source/WebInspectorUI/UserInterface/Test/Test.js >+++ b/Source/WebInspectorUI/UserInterface/Test/Test.js >@@ -165,7 +165,7 @@ WI.assumingMainTarget = () => WI.mainTarget; > WI.isDebugUIEnabled = () => false; > > WI.unlocalizedString = (string) => string; >-WI.UIString = (string) => string; >+WI.UIString = (string, key, comment) => string; > > WI.indentString = () => " "; > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 29fb744c6d9cea64afaac21ff95a910e33bd7f4f..15473cce8e49bac8f730dbc7c4b0ce1a8885091b 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,13 @@ >+2018-12-19 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: WebInspector.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 NOBODY (OOPS!). >+ >+ * Scripts/extract-localizable-js-strings: >+ > 2018-12-19 Megan Gardner <megan_gardner@apple.com> > > Allow clients to set the navigator platform >diff --git a/Tools/Scripts/extract-localizable-js-strings b/Tools/Scripts/extract-localizable-js-strings >index b4200f6ef421f4bb94f9ad89f2d450fb82686984..c89b969b1acd70bad883bf87ef637530cf2ba961 100755 >--- a/Tools/Scripts/extract-localizable-js-strings >+++ b/Tools/Scripts/extract-localizable-js-strings >@@ -74,8 +74,7 @@ for my $file (sort @files) { > 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\("([^"]+)"\)//; >- print "$file:$.:WARNING: $&\n" while s/WI\.UIString\(.*?\)//; >+ HandleUIString($1, $2 || $1, $3 || "", $file, $.) while s/WI\.UIString\("([^"]+)"(?:,\s*"([^"]+)"(?:,\s*"([^"]+)")?)?\)//; > > # Handle strings for other projects that also use this script. > HandleUIString($2, $2, "", $file, $.) while s/(\bclass="[^"]*l12n-tooltip[^"]*"[^>]*)title="([^"]+)"/$1/; >@@ -151,7 +150,9 @@ if ($sawError) { > my $localizedStrings = "var localizedStrings = new Object;\n\n"; > > for my $key (sort keys %commentByKey) { >- $localizedStrings .= "localizedStrings[\"$key\"] = \"$stringByKey{$key}\";\n"; >+ $localizedStrings .= "localizedStrings[\"$key\"] = \"$stringByKey{$key}\";"; >+ $localizedStrings .= " // $commentByKey{$key}" if length $commentByKey{$key}; >+ $localizedStrings .= "\n"; > } > > if (-e "$fileToUpdate") {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 153962
:
357764
|
357786
|
357825