Web Inspector: Make localizedString.js diff and commit friendly (UTF16 -> UTF8)
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Aug 2016 00:13:23 +0000 (00:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Aug 2016 00:13:23 +0000 (00:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=28685
<rdar://problem/16460975>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-08-27
Reviewed by Darin Adler.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* WebInspectorUI.xcodeproj/project.pbxproj:
Convert the file to UTF-8. Future diffs should display as text.

Tools:

* Scripts/extract-localizable-js-strings:
* Scripts/update-webkit-localizable-strings:
WebInspectorUI localizedStrings.js is now UTF-8. Other clients of
this script still use UTF-16, so keep that the default.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205089 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/WebInspectorUI.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/Scripts/extract-localizable-js-strings
Tools/Scripts/update-webkit-localizable-strings

index f42772e0db422c489833055ef5117e8aac344f21..d2aee27a9cb9a9955f805ddfb8972b1321b0ece8 100644 (file)
@@ -1,3 +1,15 @@
+2016-08-27  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Make localizedString.js diff and commit friendly (UTF16 -> UTF8)
+        https://bugs.webkit.org/show_bug.cgi?id=28685
+        <rdar://problem/16460975>
+
+        Reviewed by Darin Adler.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * WebInspectorUI.xcodeproj/project.pbxproj:
+        Convert the file to UTF-8. Future diffs should display as text.
+
 2016-08-26  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Add protocol version for iOS 10
index 6b8ec16b3d67e375237eeaf6a2d9aa174209623c..78f71278173237c7ae738a3e5b09dfe340c2253c 100644 (file)
Binary files a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js and b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js differ
index f9929650720dcb127f0442bccd195ab915466788..161ff2d975456de13f4846a1c74a3a1c7ae5b7c7 100644 (file)
@@ -19,7 +19,7 @@
                1C60FE3214E5F3CD006CD77D /* Version.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
                1C60FE3314E5F3CD006CD77D /* WebInspectorUIFramework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebInspectorUIFramework.xcconfig; sourceTree = "<group>"; };
                1C60FF1014E6D992006CD77D /* UserInterface */ = {isa = PBXFileReference; lastKnownFileType = folder; path = UserInterface; sourceTree = "<group>"; };
-               1C60FF1414E6E35D006CD77D /* en */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = en; path = Localizations/en.lproj/localizedStrings.js; sourceTree = "<group>"; };
+               1C60FF1414E6E35D006CD77D /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = en; path = Localizations/en.lproj/localizedStrings.js; sourceTree = "<group>"; };
                1C60FF1914E73C64006CD77D /* combine-resources.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = "combine-resources.pl"; sourceTree = "<group>"; };
                1C60FF1A14E73DCA006CD77D /* remove-console-asserts.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = "remove-console-asserts.pl"; sourceTree = "<group>"; };
                1C60FFE114E79B0F006CD77D /* copy-user-interface-resources.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = "copy-user-interface-resources.pl"; sourceTree = "<group>"; };
index 927398765ebc9edd1091c726eaffe13c22672544..f1963b783ec000bf98e0e12b30de10662d23d4f5 100644 (file)
@@ -1,3 +1,16 @@
+2016-08-27  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Make localizedString.js diff and commit friendly (UTF16 -> UTF8)
+        https://bugs.webkit.org/show_bug.cgi?id=28685
+        <rdar://problem/16460975>
+
+        Reviewed by Darin Adler.
+
+        * Scripts/extract-localizable-js-strings:
+        * Scripts/update-webkit-localizable-strings:
+        WebInspectorUI localizedStrings.js is now UTF-8. Other clients of
+        this script still use UTF-16, so keep that the default.
+
 2016-08-27  Alexey Proskuryakov  <ap@apple.com>
 
         REGRESSION (r204052): Popovers on bot watcher's dashboard are broken
index b785ed3f631f3499fd2b932f4f6a771f4ecc3da9..571c07d3b36be56f021d1c3d59b5b8bf217fb8e9 100755 (executable)
 # THE POSSIBILITY OF SUCH DAMAGE.
 
 use strict;
+use Getopt::Long;
 
-@ARGV >= 1 or die "Usage: extract-localizable-js-strings <file to update> [ directory... ]\nDid you mean to run update-webkit-localizable-strings instead?\n";
+my $utf8 = 0;
+
+my %options = (
+    'utf8' => \$utf8,
+);
+
+GetOptions(%options);
+
+@ARGV >= 1 or die "Usage: extract-localizable-js-strings [--utf8] <file to update> [ directory... ]\nDid you mean to run update-webkit-localizable-strings instead?\n";
 
 my $fileToUpdate = shift @ARGV;
 -f $fileToUpdate or die "Couldn't find file to update $fileToUpdate\n";
@@ -144,13 +153,17 @@ for my $key (sort keys %commentByKey) {
     $localizedStrings .= "localizedStrings[\"$key\"] = \"$stringByKey{$key}\";\n";
 }
 
-# Write out the strings file in UTF-16 with a BOM.
-utf8::decode($localizedStrings) if $^V ge v5.8;
-my $output = pack "n*", (0xFEFF, unpack "U*", $localizedStrings);
-
 if (-e "$fileToUpdate") {
     open STRINGS, ">", "$fileToUpdate" or die;
-    print STRINGS $output;
+    if ($utf8) {
+        # Write out the strings file in UTF-8.
+        print STRINGS $localizedStrings;
+    } else {
+        # Write out the strings file in UTF-16 with a BOM.
+        utf8::decode($localizedStrings) if $^V ge v5.8;
+        my $output = pack "n*", (0xFEFF, unpack "U*", $localizedStrings);
+        print STRINGS $output;
+    }    
     close STRINGS;
 } else {
     print "$fileToUpdate does not exist\n";
index 0d3de240e5fbe71eca40b3c0eeee2a3e5b1fe19d..85953594c5b5cf362f7ffcb11fa9f02409995fc2 100755 (executable)
@@ -46,4 +46,4 @@ my $webInspectorUIFileToUpdate = "Source/WebInspectorUI/Localizations/en.lproj/l
 chdirWebKit();
 
 system "Source/WebCore/extract-localizable-strings.pl", $webCoreFileToUpdate, @webKitDirectoriesToScan;
-system "Tools/Scripts/extract-localizable-js-strings", $webInspectorUIFileToUpdate, @webInspectorUIDirectoriesToScan;
+system "Tools/Scripts/extract-localizable-js-strings", "--utf8", $webInspectorUIFileToUpdate, @webInspectorUIDirectoriesToScan;