Title: [132455] trunk
Revision
132455
Author
[email protected]
Date
2012-10-25 00:32:35 -0700 (Thu, 25 Oct 2012)

Log Message

Web Inspector: Fix "check-inspector-strings" script and fix localized strings.
https://bugs.webkit.org/show_bug.cgi?id=100090

Patch by Eugene Klyuchnikov <[email protected]> on 2012-10-25
Reviewed by Vsevolod Vlasov.

Source/WebCore:

Fixed localized strings table.

* English.lproj/localizedStrings.js: Added missing, removed orhans.
* inspector/front-end/CSSNamedFlowView.js: Removed tailing whitespaces.
* inspector/front-end/NativeMemorySnapshotView.js:
Removed double localization.

Tools:

Script "check-inspector-strings" seems to be broken.
Fixed it, refined search algorithm.

* Scripts/check-inspector-strings: Fixed and refined.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (132454 => 132455)


--- trunk/Source/WebCore/ChangeLog	2012-10-25 07:14:23 UTC (rev 132454)
+++ trunk/Source/WebCore/ChangeLog	2012-10-25 07:32:35 UTC (rev 132455)
@@ -1,3 +1,17 @@
+2012-10-25  Eugene Klyuchnikov  <[email protected]>
+
+        Web Inspector: Fix "check-inspector-strings" script and fix localized strings.
+        https://bugs.webkit.org/show_bug.cgi?id=100090
+
+        Reviewed by Vsevolod Vlasov.
+
+        Fixed localized strings table.
+
+        * English.lproj/localizedStrings.js: Added missing, removed orhans.
+        * inspector/front-end/CSSNamedFlowView.js: Removed tailing whitespaces.
+        * inspector/front-end/NativeMemorySnapshotView.js:
+        Removed double localization.
+
 2012-10-25  Adam Barth  <[email protected]>
 
         [V8] We can merge DOMDataStore, ScopedDOMDataStore, and StaticDOMDataStore into one class

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (132454 => 132455)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-10-25 07:14:23 UTC (rev 132454)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-10-25 07:32:35 UTC (rev 132455)
@@ -136,8 +136,7 @@
 localizedStrings["DOM Node Count"] = "DOM Node Count";
 localizedStrings["Database no longer has expected version."] = "Database no longer has expected version.";
 localizedStrings["Deactivate breakpoints."] = "Deactivate breakpoints.";
-localizedStrings["Deactivate breakpoints"] = "Deactivate breakpoints";
-localizedStrings["Debug"] = "Debug";
+localizedStrings["Deactivate Breakpoints"] = "Deactivate Breakpoints";
 localizedStrings["Debugging disabled. Click to enable."] = "Debugging disabled. Click to enable.";
 localizedStrings["Debugging enabled. Click to disable."] = "Debugging enabled. Click to disable.";
 localizedStrings["Delete Node"] = "Delete Node";
@@ -621,6 +620,8 @@
 localizedStrings["Remove all DOM breakpoints"] = "Remove all DOM breakpoints";
 localizedStrings["Enable All Breakpoints"] = "Enable All Breakpoints";
 localizedStrings["Enable all breakpoints"] = "Enable all breakpoints";
+localizedStrings["Disable all breakpoints"] = "Disable all breakpoints";
+localizedStrings["Disable All Breakpoints"] = "Disable All Breakpoints";
 localizedStrings["Enable source maps"] = "Enable source maps";
 localizedStrings["Experiments"] = "Experiments";
 localizedStrings["WARNING:"] = "WARNING:";
@@ -763,3 +764,27 @@
 localizedStrings["Modification Time"] = "Modification Time";
 localizedStrings["Directory"] = "Directory";
 localizedStrings["-"] = "-";
+localizedStrings["Memory cache resources"] = "Memory cache resources";
+localizedStrings["_javascript_ heap"] = "_javascript_ heap";
+localizedStrings["DOM storage cache"] = "DOM storage cache";
+localizedStrings["Live native memory chart"] = "Live native memory chart";
+localizedStrings["Support for SASS"] = "Support for SASS";
+localizedStrings["Render tree used"] = "Render tree used";
+localizedStrings["Snippets support"] = "Snippets support";
+localizedStrings["Inspector data"] = "Inspector data";
+localizedStrings["FileSystem inspection"] = "FileSystem inspection";
+localizedStrings["Use CodeMirror editor"] = "Use CodeMirror editor";
+localizedStrings["Override Device Geolocation"] = "Override Device Geolocation";
+localizedStrings["Page's structures"] = "Page's structures";
+localizedStrings["Native memory profiling"] = "Native memory profiling";
+localizedStrings["OwnersTypePlaceholder"] = "OwnersTypePlaceholder";
+localizedStrings["_javascript_ external arrays"] = "_javascript_ external arrays";
+localizedStrings["_javascript_ external strings"] = "_javascript_ external strings";
+localizedStrings["Show CPU activity in Timeline"] = "Show CPU activity in Timeline";
+localizedStrings["Render tree"] = "Render tree";
+localizedStrings["Canvas inspection"] = "Canvas inspection";
+localizedStrings["Used _javascript_ heap"] = "Used _javascript_ heap";
+localizedStrings["_javascript_ external resources"] = "_javascript_ external resources";
+localizedStrings["Glyph cache resources"] = "Glyph cache resources";
+localizedStrings["CSS Regions Support"] = "CSS Regions Support";
+localizedStrings["Scroll"] = "Scroll";

Modified: trunk/Source/WebCore/inspector/front-end/CSSNamedFlowView.js (132454 => 132455)


--- trunk/Source/WebCore/inspector/front-end/CSSNamedFlowView.js	2012-10-25 07:14:23 UTC (rev 132454)
+++ trunk/Source/WebCore/inspector/front-end/CSSNamedFlowView.js	2012-10-25 07:32:35 UTC (rev 132455)
@@ -81,7 +81,7 @@
         treeOutline.wireToDomAgent();
         WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, treeOutline._elementsTreeUpdater._documentUpdated, treeOutline._elementsTreeUpdater);
 
-        return treeOutline;        
+        return treeOutline;
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (132454 => 132455)


--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-10-25 07:14:23 UTC (rev 132454)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-10-25 07:32:35 UTC (rev 132455)
@@ -285,7 +285,7 @@
 
         var swatchElement = this._memoryBlockList.createChild("div", "item");
         swatchElement.createChild("div", "swatch").style.backgroundColor = viewProperties._fillStyle;
-        swatchElement.createChild("span", "title").textContent = WebInspector.UIString(title);
+        swatchElement.createChild("span", "title").textContent = title;
 
         if (!memoryBlock.children || !includeChildren)
             return;

Modified: trunk/Tools/ChangeLog (132454 => 132455)


--- trunk/Tools/ChangeLog	2012-10-25 07:14:23 UTC (rev 132454)
+++ trunk/Tools/ChangeLog	2012-10-25 07:32:35 UTC (rev 132455)
@@ -1,3 +1,15 @@
+2012-10-25  Eugene Klyuchnikov  <[email protected]>
+
+        Web Inspector: Fix "check-inspector-strings" script and fix localized strings.
+        https://bugs.webkit.org/show_bug.cgi?id=100090
+
+        Reviewed by Vsevolod Vlasov.
+
+        Script "check-inspector-strings" seems to be broken.
+        Fixed it, refined search algorithm.
+
+        * Scripts/check-inspector-strings: Fixed and refined.
+
 2012-10-24  Dirk Pranke  <[email protected]>
 
         nrwt: fix a couple of minor crashing issues under cygwin

Modified: trunk/Tools/Scripts/check-inspector-strings (132454 => 132455)


--- trunk/Tools/Scripts/check-inspector-strings	2012-10-25 07:14:23 UTC (rev 132454)
+++ trunk/Tools/Scripts/check-inspector-strings	2012-10-25 07:32:35 UTC (rev 132455)
@@ -35,7 +35,9 @@
 import re
 import sys
 
-from webkitpy.common.checkout.scm import detect_scm_system
+from webkitpy.common.checkout.scm import SCMDetector
+from webkitpy.common.system.filesystem import FileSystem
+from webkitpy.common.system.executive import Executive
 from webkitpy.common.system.logutils import configure_logging
 from webkitpy.style.checker import ProcessorBase
 from webkitpy.style.filereader import TextFileReader
@@ -47,10 +49,6 @@
 
 _log = logging.getLogger("check-inspector-strings")
 
-def decode_unicode_escapes(s):
-    xNN_converted_to_u00NN = s.replace("\\x", "\\u00")
-    return eval("ur\"" + xNN_converted_to_u00NN + "\"")
-
 class StringsExtractor(ProcessorBase):
     def __init__(self, patterns):
         self._patterns = patterns
@@ -70,7 +68,7 @@
             for pattern in self._patterns:
                 line_strings = re.findall(pattern, line)
                 for string in line_strings:
-                    self.strings[index].append(decode_unicode_escapes(string))
+                    self.strings[index].append(string)
                 index += 1
 
 class LocalizedStringsExtractor:
@@ -78,22 +76,60 @@
         self.localized_strings = []
 
     def process_file(self, file_path):
-        localized_strings_file = codecs.open(file_path, encoding="utf-16", mode="r")
+        localized_strings_file = codecs.open(file_path, encoding="utf-8", mode="r")
         try:
             contents = localized_strings_file.read()
             lines = contents.split("\n")
             for line in lines:
                 match = re.match(r"localizedStrings\[\"((?:[^\"\\]|\\.)*?)\"", line)
                 if match:
-                    self.localized_strings.append(decode_unicode_escapes(match.group(1)))
+                    self.localized_strings.append(match.group(1))
         finally:
             localized_strings_file.close()
 
+def extract_ui_strings(str, out):
+    line_unrecognized = False
+    idx = 0
+    while idx < len(str):
+        idx = str.find("WebInspector.UIString(", idx)
+        if idx == -1:
+            break
+        idx = idx + len("WebInspector.UIString(")
+        balance = 1
+        item_recognized = False
+        while idx < len(str):
+            if str[idx] == ')':
+                balance = balance - 1
+                if balance == 0:
+                    break
+            elif str[idx] == '(':
+                balance = balance + 1
+            elif balance == 1:
+                if str[idx] == ',':
+                    break
+                elif str[idx] == '"':
+                    str_idx = idx + 1
+                    while str_idx < len(str):
+                        if str[str_idx] == '\\':
+                            str_idx = str_idx + 1
+                        elif str[str_idx] == '"':
+                            out.add(str[idx + 1 : str_idx])
+                            idx = str_idx
+                            item_recognized = True
+                            break
+                        str_idx = str_idx + 1
+            idx = idx + 1
+        if not item_recognized:
+            line_unrecognized = True
+    if line_unrecognized:
+        _log.info("Unrecognized: %s" % str)
+
 if __name__ == "__main__":
     configure_logging()
 
     cwd = os.path.abspath(os.curdir)
-    scm = detect_scm_system(cwd)
+    filesystem = FileSystem()
+    scm = SCMDetector(filesystem, Executive()).detect_scm_system(cwd)
 
     if scm is None:
         _log.error("WebKit checkout not found: You must run this script "
@@ -102,14 +138,17 @@
 
     checkout_root = scm.checkout_root
     _log.debug("WebKit checkout found with root: %s" % checkout_root)
-    change_directory(checkout_root=checkout_root, paths=None)
+    change_directory(filesystem, checkout_root=checkout_root, paths=None)
 
-    strings_extractor = StringsExtractor([r"WebInspector\.(?:UIString|formatLocalized)\(\"((?:[^\"\\]|\\.)*?)\"", r"\"((?:[^\"\\]|\\.)*?)\""])
-    file_reader = TextFileReader(strings_extractor)
+    strings_extractor = StringsExtractor([r"(WebInspector\.UIString\(.*)", r"\"((?:[^\"\\]|\\.)*?)\""])
+    file_reader = TextFileReader(filesystem, strings_extractor)
     file_reader.process_paths([_inspector_directory, _devtools_directory])
     localized_strings_extractor = LocalizedStringsExtractor()
     localized_strings_extractor.process_file(_localized_strings)
-    ui_strings = frozenset(strings_extractor.strings[0])
+    raw_ui_strings = frozenset(strings_extractor.strings[0])
+    ui_strings = set()
+    for s in raw_ui_strings:
+        extract_ui_strings(s, ui_strings)
     strings = frozenset(strings_extractor.strings[1])
     localized_strings = frozenset(localized_strings_extractor.localized_strings)
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to