[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

mnaganov at chromium.org mnaganov at chromium.org
Sun Feb 20 22:51:42 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit fa6b5c661d95054116e19dc94518422819256fda
Author: mnaganov at chromium.org <mnaganov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 12 16:42:46 2011 +0000

    2011-01-12  Mikhail Naganov  <mnaganov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Add check-inspector-strings script.
            Fix inconsistencies in Inspector strings found by the script.
    
            https://bugs.webkit.org/show_bug.cgi?id=52295
    
            * English.lproj/localizedStrings.js:
            * inspector/front-end/BreakpointsSidebarPane.js:
            (WebInspector.EventListenerBreakpointsSidebarPane):
            * inspector/front-end/ProfilesPanel.js:
            (WebInspector.ProfilesPanel.prototype.setRecordingProfile):
            * inspector/front-end/Resource.js:
            (WebInspector.Resource.Type.toString):
            * inspector/front-end/ResourcesPanel.js:
            (WebInspector.ResourceRevisionTreeElement):
            * inspector/front-end/utilities.js:
            ():
            * Scripts/check-inspector-strings: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75613 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index f3a27d0..9111ba4 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2011-01-12  Mikhail Naganov  <mnaganov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Fix inconsistencies in Inspector strings found by the new check-inspector-strings script.
+
+        https://bugs.webkit.org/show_bug.cgi?id=52295
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/BreakpointsSidebarPane.js:
+        (WebInspector.EventListenerBreakpointsSidebarPane):
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfilesPanel.prototype.setRecordingProfile):
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.Type.toString):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourceRevisionTreeElement):
+        * inspector/front-end/utilities.js:
+        ():
+
 2011-01-12  Yury Semikhatsky  <yurys at chromium.org>
 
         Unreviewed. Fix WML compilation on Mac.
diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js
index d137cfc..95867a4 100644
Binary files a/Source/WebCore/English.lproj/localizedStrings.js and b/Source/WebCore/English.lproj/localizedStrings.js differ
diff --git a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
index 619525c..6103c00 100644
--- a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -265,17 +265,17 @@ WebInspector.EventListenerBreakpointsSidebarPane = function()
     WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.EventListenerBreakpointAdded, this._breakpointAdded, this);
 
     this._breakpointItems = {};
-    this._createCategory("Keyboard", "listener", ["keydown", "keyup", "keypress", "textInput"]);
-    this._createCategory("Mouse", "listener", ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
+    this._createCategory(/*@LS*/"Keyboard", "listener", ["keydown", "keyup", "keypress", "textInput"]);
+    this._createCategory(/*@LS*/"Mouse", "listener", ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
     // FIXME: uncomment following once inspector stops being drop targer in major ports.
     // Otherwise, inspector page reacts on drop event and tries to load the event data.
-    // this._createCategory("Drag", "listener", ["drag", "drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]);
-    this._createCategory("Control", "listener", ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
-    this._createCategory("Clipboard", "listener", ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
-    this._createCategory("Load", "listener", ["load", "unload", "abort", "error"]);
-    this._createCategory("DOM Mutation", "listener", ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
-    this._createCategory("Device", "listener", ["deviceorientation", "devicemotion"]);
-    this._createCategory("Timer", "instrumentation", ["setTimer", "clearTimer", "timerFired"]);
+    // this._createCategory(/*@LS*/"Drag", "listener", ["drag", "drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]);
+    this._createCategory(/*@LS*/"Control", "listener", ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
+    this._createCategory(/*@LS*/"Clipboard", "listener", ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
+    this._createCategory(/*@LS*/"Load", "listener", ["load", "unload", "abort", "error"]);
+    this._createCategory(/*@LS*/"DOM Mutation", "listener", ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
+    this._createCategory(/*@LS*/"Device", "listener", ["deviceorientation", "devicemotion"]);
+    this._createCategory(/*@LS*/"Timer", "instrumentation", ["setTimer", "clearTimer", "timerFired"]);
 }
 
 WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js
index bff5be7..65fc15e 100644
--- a/Source/WebCore/inspector/front-end/ProfilesPanel.js
+++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js
@@ -623,7 +623,7 @@ WebInspector.ProfilesPanel.prototype = {
             if (!this._temporaryRecordingProfile) {
                 this._temporaryRecordingProfile = {
                     typeId: WebInspector.CPUProfileType.TypeId,
-                    title: WebInspector.UIString("Recording"),
+                    title: WebInspector.UIString("Recording…"),
                     uid: -1,
                     isTemporary: true
                 };
diff --git a/Source/WebCore/inspector/front-end/Resource.js b/Source/WebCore/inspector/front-end/Resource.js
index 063ca43..fd56ee9 100644
--- a/Source/WebCore/inspector/front-end/Resource.js
+++ b/Source/WebCore/inspector/front-end/Resource.js
@@ -64,24 +64,24 @@ WebInspector.Resource.Type = {
     {
         switch (type) {
             case this.Document:
-                return "document";
+                return /*@LS*/"document";
             case this.Stylesheet:
-                return "stylesheet";
+                return /*@LS*/"stylesheet";
             case this.Image:
-                return "image";
+                return /*@LS*/"image";
             case this.Font:
-                return "font";
+                return /*@LS*/"font";
             case this.Script:
-                return "script";
+                return /*@LS*/"script";
             case this.XHR:
-                return "xhr";
+                return /*@LS*/"xhr";
             case this.Media:
-                return "media";
+                return /*@LS*/"media";
             case this.WebSocket:
-                return "websocket";
+                return /*@LS*/"websocket";
             case this.Other:
             default:
-                return "other";
+                return /*@LS*/"other";
         }
     }
 }
diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js
index ecb826f..075249a 100644
--- a/Source/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js
@@ -1227,7 +1227,7 @@ WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.Base
 
 WebInspector.ResourceRevisionTreeElement = function(storagePanel, revision)
 {
-    var title = revision.timestamp ? revision.timestamp.toLocaleTimeString() : "(original)";
+    var title = revision.timestamp ? revision.timestamp.toLocaleTimeString() : WebInspector.UIString("(original)");
     WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, title, "resource-sidebar-tree-item resources-category-" + revision.category.name);
     if (revision.timestamp)
         this.tooltip = revision.timestamp.toLocaleString();
diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js
index 11f6386..653e53a 100644
--- a/Source/WebCore/inspector/front-end/utilities.js
+++ b/Source/WebCore/inspector/front-end/utilities.js
@@ -658,23 +658,23 @@ Number.secondsToString = function(seconds, formatterFunction, higherResolution)
 
     var ms = seconds * 1000;
     if (higherResolution && ms < 1000)
-        return formatterFunction("%.3fms", ms);
+        return formatterFunction(/*@LS*/"%.3fms", ms);
     else if (ms < 1000)
-        return formatterFunction("%.0fms", ms);
+        return formatterFunction(/*@LS*/"%.0fms", ms);
 
     if (seconds < 60)
-        return formatterFunction("%.2fs", seconds);
+        return formatterFunction(/*@LS*/"%.2fs", seconds);
 
     var minutes = seconds / 60;
     if (minutes < 60)
-        return formatterFunction("%.1fmin", minutes);
+        return formatterFunction(/*@LS*/"%.1fmin", minutes);
 
     var hours = minutes / 60;
     if (hours < 24)
-        return formatterFunction("%.1fhrs", hours);
+        return formatterFunction(/*@LS*/"%.1fhrs", hours);
 
     var days = hours / 24;
-    return formatterFunction("%.1f days", days);
+    return formatterFunction(/*@LS*/"%.1f days", days);
 }
 
 Number.bytesToString = function(bytes, formatterFunction, higherResolution)
@@ -685,19 +685,19 @@ Number.bytesToString = function(bytes, formatterFunction, higherResolution)
         higherResolution = true;
 
     if (bytes < 1024)
-        return formatterFunction("%.0fB", bytes);
+        return formatterFunction(/*@LS*/"%.0fB", bytes);
 
     var kilobytes = bytes / 1024;
     if (higherResolution && kilobytes < 1024)
-        return formatterFunction("%.2fKB", kilobytes);
+        return formatterFunction(/*@LS*/"%.2fKB", kilobytes);
     else if (kilobytes < 1024)
-        return formatterFunction("%.0fKB", kilobytes);
+        return formatterFunction(/*@LS*/"%.0fKB", kilobytes);
 
     var megabytes = kilobytes / 1024;
     if (higherResolution)
-        return formatterFunction("%.2fMB", megabytes);
+        return formatterFunction(/*@LS*/"%.2fMB", megabytes);
     else
-        return formatterFunction("%.0fMB", megabytes);
+        return formatterFunction(/*@LS*/"%.0fMB", megabytes);
 }
 
 Number.constrain = function(num, min, max)
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 00512fa..8f8a6a8 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-12  Mikhail Naganov  <mnaganov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Add check-inspector-strings script.
+
+        https://bugs.webkit.org/show_bug.cgi?id=52295
+
+        * Scripts/check-inspector-strings: Added.
+
 2011-01-12  Adam Roben  <aroben at apple.com>
 
         Advertise the .testnetscape file extension on Windows
diff --git a/Tools/Scripts/check-inspector-strings b/Tools/Scripts/check-inspector-strings
new file mode 100755
index 0000000..901d502
--- /dev/null
+++ b/Tools/Scripts/check-inspector-strings
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#    * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import codecs
+import logging
+import re
+import sys
+
+from webkitpy.style_references import detect_checkout
+from webkitpy.common.system.logutils import configure_logging
+from webkitpy.style.checker import ProcessorBase
+from webkitpy.style.filereader import TextFileReader
+from webkitpy.style.main import change_directory
+
+_inspector_directory = "Source/WebCore/inspector/front-end"
+_localized_strings = "Source/WebCore/English.lproj/localizedStrings.js"
+
+_log = logging.getLogger("check-inspector-strings")
+
+class StringsExtractor(ProcessorBase):
+    def __init__(self, patterns):
+        self._patterns = patterns
+        self.strings = []
+        for p in self._patterns:
+            self.strings.append([])
+
+    def should_process(self, file_path):
+        return file_path.endswith(".js") and (not file_path.endswith("InjectedScript.js"))
+
+    def process(self, lines, file_path, line_numbers=None):
+        for line in lines:
+            comment_start = line.find("//")
+            if comment_start != -1:
+                line = line[:comment_start]
+            index = 0
+            for pattern in self._patterns:
+                line_strings = re.findall(pattern, line)
+                for string in line_strings:
+                    self.strings[index].append(string)
+                index += 1
+
+class LocalizedStringsExtractor:
+    def __init__(self):
+        self.localized_strings = []
+
+    def process_file(self, file_path):
+        localized_strings_file = codecs.open(file_path, encoding="utf-16", 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(match.group(1))
+        finally:
+            localized_strings_file.close()
+
+if __name__ == "__main__":
+    configure_logging()
+
+    checkout = detect_checkout()
+    if checkout is None:
+        _log.error("WebKit checkout not found: You must run this script "
+                   "from within a WebKit checkout.")
+        sys.exit(1)
+    checkout_root = checkout.root_path()
+    _log.debug("WebKit checkout found with root: %s" % checkout_root)
+    change_directory(checkout_root=checkout_root, paths=None)
+
+    strings_extractor = StringsExtractor([r"(?:WebInspector\.(?:UIString|formatLocalized)\(|/\*@LS\*/)\"((?:[^\"\\]|\\.)*?)\"", r"\"((?:[^\"\\]|\\.)*?)\""])
+    file_reader = TextFileReader(strings_extractor)
+    file_reader.process_paths([_inspector_directory])
+    localized_strings_extractor = LocalizedStringsExtractor()
+    localized_strings_extractor.process_file(_localized_strings)
+    ui_strings = frozenset(strings_extractor.strings[0])
+    strings = frozenset(strings_extractor.strings[1])
+    localized_strings = frozenset(localized_strings_extractor.localized_strings)
+
+    new_strings = ui_strings - localized_strings
+    for s in new_strings:
+        _log.info("New: \"%s\"" % (s))
+    old_strings = localized_strings - ui_strings
+    suspicious_strings = strings & old_strings
+    for s in suspicious_strings:
+        _log.info("Suspicious: \"%s\"" % (s))
+    unused_strings = old_strings - strings
+    for s in unused_strings:
+        _log.info("Unused: \"%s\"" % (s))

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list