WebCore:
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Nov 2007 06:40:27 +0000 (06:40 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Nov 2007 06:40:27 +0000 (06:40 +0000)
        Reviewed by Mark Rowe.

        Bug 13470: i18n: The Web Inspector is not localizable
        http://bugs.webkit.org/show_bug.cgi?id=13470

        Add support for localization to the Web Inspector. Clients need to
        implement localizedStringsURL() to return the URL of the
        InspectorLocalizedStrings.js that best matches the user's language.

        * English.lproj: Added.
        * English.lproj/InspectorLocalizedStrings.js: Added.
        * WebCore.xcodeproj/project.pbxproj: Add InspectorLocalizedStrings.js.
        * page/InspectorClient.h: Add localizedStringsURL.
        * page/InspectorController.cpp: Add localizedStringsURL that calls
          the client. Also added a version exposed to JavaScript.
        * page/InspectorController.h: Add localizedStringsURL.
        * page/inspector/ConsolePanel.js: Call WebInspector.UIString
          for user visible strings.
        * page/inspector/DatabasePanel.js: Ditto.
        * page/inspector/DocumentPanel.js: Ditto.
        * page/inspector/ImagePanel.js: Ditto.
        * page/inspector/MetricsSidebarPane.js: Ditto.
        * page/inspector/NetworkPanel.js: Ditto.
        * page/inspector/Panel.js: Ditto.
        * page/inspector/PropertiesSidebarPane.js: Ditto.
        * page/inspector/Resource.js: Ditto.
        * page/inspector/ResourceCategory.js: Ditto.
        * page/inspector/SourcePanel.js: Ditto.
        * page/inspector/StylesSidebarPane.js: Ditto.
        * page/inspector/inspector.css: Use pre-wrap so database errors can use \n.
        * page/inspector/inspector.html: Remove some user visible strings.
        * page/inspector/inspector.js: Added WebInspector.UIString and call
          WebInspector.UIString for user visible strings. Some code needed to be
          moved to WebInspector.loaded to use UIString after the localized strings
          get loaded.
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyFrameLoaderClient::redirectDataToPlugin): Remove WebCore:: prefix.
        (WebCore::SVGEmptyInspectorClient::createPage): Ditto.
        (WebCore::SVGEmptyInspectorClient::localizedStringsURL): Add empty stub.
        (WebCore::SVGEmptyInspectorClient::highlight): Remove WebCore:: prefix.
        (WebCore::SVGEmptyInspectorClient::inspectedURLChanged): Ditto.

WebKit:

        Reviewed by Mark Rowe.

        Bug 13470: i18n: The Web Inspector is not localizable
        http://bugs.webkit.org/show_bug.cgi?id=13470

        Update the localized strings and the file encoding of WebInspectorClient.mm.

        * English.lproj/Localizable.strings:
        * StringsNotToBeLocalized.txt:
        * WebKit.xcodeproj/project.pbxproj:

WebKit/gtk:

        Reviewed by Mark Rowe.

        Bug 13470: i18n: The Web Inspector is not localizable
        http://bugs.webkit.org/show_bug.cgi?id=13470

        * WebCoreSupport/InspectorClientGtk.cpp:
        (WebKit::InspectorClient::localizedStringsURL): Empty stub.
        * WebCoreSupport/InspectorClientGtk.h: Add localizedStringsURL.

WebKit/mac:

        Reviewed by Mark Rowe.

        Bug 13470: i18n: The Web Inspector is not localizable
        http://bugs.webkit.org/show_bug.cgi?id=13470

        Implement the localizedStringsURL() client method to return the
        localized URL of InspectorLocalizedStrings.js in WebCore.

        * WebCoreSupport/WebInspectorClient.h: Added localizedStringsURL.
        * WebCoreSupport/WebInspectorClient.mm:
        (WebInspectorClient::localizedStringsURL): Added.
        (WebInspectorClient::updateWindowTitle): Localized the window title.
        (-[WebInspectorWindowController init]): Remove a FIXME that dosen't make sense anymore.
        (-[WebInspectorWindowController initWithInspectedWebView:]): Code style cleanup.

WebKit/qt:

        Reviewed by Mark Rowe.

        Bug 13470: i18n: The Web Inspector is not localizable
        http://bugs.webkit.org/show_bug.cgi?id=13470

        * WebCoreSupport/InspectorClientQt.cpp:
        (WebCore::InspectorClientQt::localizedStringsURL): Empty stub.
        * WebCoreSupport/InspectorClientQt.h: Added localizedStringsURL.

WebKit/win:

        Reviewed by Mark Rowe.

        Bug 13470: i18n: The Web Inspector is not localizable
        http://bugs.webkit.org/show_bug.cgi?id=13470

        * English.lproj/Localizable.strings: Updated.
        * WebInspectorClient.cpp:
        (WebInspectorClient::localizedStringsURL): Empty stub.
        * WebInspectorClient.h: Added localizedStringsURL.

WebKit/wx:

        Reviewed by Mark Rowe.

        Bug 13470: i18n: The Web Inspector is not localizable
        http://bugs.webkit.org/show_bug.cgi?id=13470

        * WebKitSupport/InspectorClientWx.cpp:
        (WebCore::InspectorClientWx::localizedStringsURL): Empty stub.
        * WebKitSupport/InspectorClientWx.h: Added localizedStringsURL.

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

42 files changed:
WebCore/ChangeLog
WebCore/English.lproj/InspectorLocalizedStrings.js [new file with mode: 0644]
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/page/InspectorClient.h
WebCore/page/InspectorController.cpp
WebCore/page/InspectorController.h
WebCore/page/inspector/ConsolePanel.js
WebCore/page/inspector/DatabasePanel.js
WebCore/page/inspector/DocumentPanel.js
WebCore/page/inspector/ImagePanel.js
WebCore/page/inspector/MetricsSidebarPane.js
WebCore/page/inspector/NetworkPanel.js
WebCore/page/inspector/Panel.js
WebCore/page/inspector/PropertiesSidebarPane.js
WebCore/page/inspector/Resource.js
WebCore/page/inspector/ResourceCategory.js
WebCore/page/inspector/SourcePanel.js
WebCore/page/inspector/StylesSidebarPane.js
WebCore/page/inspector/inspector.css
WebCore/page/inspector/inspector.html
WebCore/page/inspector/inspector.js
WebCore/platform/graphics/svg/SVGImageEmptyClients.h
WebKit/ChangeLog
WebKit/English.lproj/Localizable.strings
WebKit/StringsNotToBeLocalized.txt
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebInspectorClient.h
WebKit/mac/WebCoreSupport/WebInspectorClient.mm
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
WebKit/qt/WebCoreSupport/InspectorClientQt.h
WebKit/win/ChangeLog
WebKit/win/English.lproj/Localizable.strings
WebKit/win/WebInspectorClient.cpp
WebKit/win/WebInspectorClient.h
WebKit/wx/ChangeLog
WebKit/wx/WebKitSupport/InspectorClientWx.cpp
WebKit/wx/WebKitSupport/InspectorClientWx.h

index 3089c51..017ff69 100644 (file)
@@ -1,5 +1,49 @@
 2007-11-17  Timothy Hatcher  <timothy@apple.com>
 
+        Reviewed by Mark Rowe.
+
+        Bug 13470: i18n: The Web Inspector is not localizable
+        http://bugs.webkit.org/show_bug.cgi?id=13470
+
+        Add support for localization to the Web Inspector. Clients need to
+        implement localizedStringsURL() to return the URL of the
+        InspectorLocalizedStrings.js that best matches the user's language.
+
+        * English.lproj: Added.
+        * English.lproj/InspectorLocalizedStrings.js: Added.
+        * WebCore.xcodeproj/project.pbxproj: Add InspectorLocalizedStrings.js.
+        * page/InspectorClient.h: Add localizedStringsURL.
+        * page/InspectorController.cpp: Add localizedStringsURL that calls
+          the client. Also added a version exposed to JavaScript.
+        * page/InspectorController.h: Add localizedStringsURL.
+        * page/inspector/ConsolePanel.js: Call WebInspector.UIString
+          for user visible strings.
+        * page/inspector/DatabasePanel.js: Ditto.
+        * page/inspector/DocumentPanel.js: Ditto.
+        * page/inspector/ImagePanel.js: Ditto.
+        * page/inspector/MetricsSidebarPane.js: Ditto.
+        * page/inspector/NetworkPanel.js: Ditto.
+        * page/inspector/Panel.js: Ditto.
+        * page/inspector/PropertiesSidebarPane.js: Ditto.
+        * page/inspector/Resource.js: Ditto.
+        * page/inspector/ResourceCategory.js: Ditto.
+        * page/inspector/SourcePanel.js: Ditto.
+        * page/inspector/StylesSidebarPane.js: Ditto.
+        * page/inspector/inspector.css: Use pre-wrap so database errors can use \n.
+        * page/inspector/inspector.html: Remove some user visible strings.
+        * page/inspector/inspector.js: Added WebInspector.UIString and call
+          WebInspector.UIString for user visible strings. Some code needed to be 
+          moved to WebInspector.loaded to use UIString after the localized strings
+          get loaded.
+        * platform/graphics/svg/SVGImageEmptyClients.h:
+        (WebCore::SVGEmptyFrameLoaderClient::redirectDataToPlugin): Remove WebCore:: prefix.
+        (WebCore::SVGEmptyInspectorClient::createPage): Ditto.
+        (WebCore::SVGEmptyInspectorClient::localizedStringsURL): Add empty stub.
+        (WebCore::SVGEmptyInspectorClient::highlight): Remove WebCore:: prefix.
+        (WebCore::SVGEmptyInspectorClient::inspectedURLChanged): Ditto.
+
+2007-11-17  Timothy Hatcher  <timothy@apple.com>
+
         Reviewed by Adam.
 
         Reworte String.sprintf to fix many bad bugs and to not use RegExp. Also added
diff --git a/WebCore/English.lproj/InspectorLocalizedStrings.js b/WebCore/English.lproj/InspectorLocalizedStrings.js
new file mode 100644 (file)
index 0000000..937fcf5
Binary files /dev/null and b/WebCore/English.lproj/InspectorLocalizedStrings.js differ
index edfa89d..2f665b9 100644 (file)
                1C14E76C0AD8C81C00B6158B /* deleteButton.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1C14E76A0AD8C81C00B6158B /* deleteButton.tiff */; };
                1C4C8F020AD85D87009475CE /* DeleteButtonController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4C8F000AD85D87009475CE /* DeleteButtonController.h */; };
                1C4C8F660AD8655D009475CE /* DeleteButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4C8F640AD8655D009475CE /* DeleteButton.h */; };
+               1C6B7C9A0CEFC9D00076DE61 /* InspectorLocalizedStrings.js in Resources */ = {isa = PBXBuildFile; fileRef = 1C6B7C980CEFC9BE0076DE61 /* InspectorLocalizedStrings.js */; };
                1CAF34810A6C405200ABE06E /* WebScriptObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF347E0A6C405200ABE06E /* WebScriptObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1CAF34820A6C405200ABE06E /* WebScriptObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CAF347F0A6C405200ABE06E /* WebScriptObject.mm */; };
                1CAF34830A6C405200ABE06E /* WebScriptObjectPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */; settings = {ATTRIBUTES = (); }; };
                1C4C8F000AD85D87009475CE /* DeleteButtonController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeleteButtonController.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                1C4C8F630AD8655D009475CE /* DeleteButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeleteButton.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                1C4C8F640AD8655D009475CE /* DeleteButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeleteButton.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               1C6B7C990CEFC9BE0076DE61 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = sourcecode.javascript; name = English; path = English.lproj/InspectorLocalizedStrings.js; sourceTree = SOURCE_ROOT; };
                1C904DF90BA9D2C80081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
                1CAF347E0A6C405200ABE06E /* WebScriptObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptObject.h; sourceTree = "<group>"; };
                1CAF347F0A6C405200ABE06E /* WebScriptObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebScriptObject.mm; sourceTree = "<group>"; };
                089C1665FE841158C02AAC07 /* Resources */ = {
                        isa = PBXGroup;
                        children = (
+                               1C6B7C980CEFC9BE0076DE61 /* InspectorLocalizedStrings.js */,
                                1AB1AE780C051FDE00139F4F /* zoomInCursor.png */,
                                1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */,
                                464EA2710B8A350B00A8E6E3 /* crossHairCursor.png */,
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               1C6B7C9A0CEFC9D00076DE61 /* InspectorLocalizedStrings.js in Resources */,
                                B2E27C4E0B0F2AE600F17C7B /* WKArithmeticFilter.cikernel in Resources */,
                                B2E27C510B0F2AE600F17C7B /* WKComponentMergeFilter.cikernel in Resources */,
                                B2E27C540B0F2AE600F17C7B /* WKDiffuseLightingFilter.cikernel in Resources */,
                };
 /* End PBXTargetDependency section */
 
+/* Begin PBXVariantGroup section */
+               1C6B7C980CEFC9BE0076DE61 /* InspectorLocalizedStrings.js */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               1C6B7C990CEFC9BE0076DE61 /* English */,
+                       );
+                       name = InspectorLocalizedStrings.js;
+                       sourceTree = "<group>";
+               };
+/* End PBXVariantGroup section */
+
 /* Begin XCBuildConfiguration section */
                149C283A08902B11008A9EFC /* Debug */ = {
                        isa = XCBuildConfiguration;
index ee6dade..ec1ee92 100644 (file)
@@ -40,6 +40,8 @@ public:
 
     virtual Page* createPage() = 0;
 
+    virtual String localizedStringsURL() = 0;
+
     virtual void showWindow() = 0;
     virtual void closeWindow() = 0;
 
index a903044..4a40df2 100644 (file)
@@ -544,6 +544,23 @@ static JSValueRef inspectedWindow(JSContextRef ctx, JSObjectRef /*function*/, JS
     return toRef(KJS::Window::retrieve(controller->inspectedPage()->mainFrame()));
 }
 
+static JSValueRef localizedStrings(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
+{
+    InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+    if (!controller)
+        return JSValueMakeUndefined(ctx);
+
+    String url = controller->localizedStringsURL();
+    if (url.isNull())
+        return JSValueMakeNull(ctx);
+
+    JSStringRef urlString = JSStringCreateWithCharacters(url.characters(), url.length());
+    JSValueRef urlValue = JSValueMakeString(ctx, urlString);
+    JSStringRelease(urlString);
+
+    return urlValue;
+}
+
 InspectorController::InspectorController(Page* page, InspectorClient* client)
     : m_inspectedPage(page)
     , m_client(client)
@@ -583,6 +600,13 @@ bool InspectorController::enabled() const
     return m_inspectedPage->settings()->developerExtrasEnabled();
 }
 
+String InspectorController::localizedStringsURL()
+{
+    if (!enabled())
+        return String();
+    return m_client->localizedStringsURL();
+}
+
 void InspectorController::inspect(Node* node)
 {
     if (!node || !enabled())
@@ -728,6 +752,7 @@ void InspectorController::windowScriptObjectAvailable()
         { "databaseTableNames", databaseTableNames, kJSPropertyAttributeNone },
 #endif
         { "inspectedWindow", inspectedWindow, kJSPropertyAttributeNone },
+        { "localizedStringsURL", localizedStrings, kJSPropertyAttributeNone },
         { 0, 0, 0 }
     };
 
index cac9f3d..1686cb7 100644 (file)
@@ -70,6 +70,8 @@ public:
 
     Page* inspectedPage() const { return m_inspectedPage; }
 
+    String localizedStringsURL();
+
     void inspect(Node*);
     void highlight(Node*);
     void hideHighlight();
index 4316911..563d332 100644 (file)
@@ -53,13 +53,13 @@ WebInspector.ConsolePanel.prototype = {
     show: function()
     {
         WebInspector.Panel.prototype.show.call(this);
-        WebInspector.consoleListItem.item.select();
+        WebInspector.consoleListItem.select();
     },
 
     hide: function()
     {
         WebInspector.Panel.prototype.hide.call(this);
-        WebInspector.consoleListItem.item.deselect();
+        WebInspector.consoleListItem.deselect();
     },
 
     addMessage: function(msg)
@@ -275,18 +275,18 @@ WebInspector.ConsoleMessage.prototype = {
 
         var messageDiv = document.createElement("div");
         messageDiv.className = "console-message-message";
-        messageDiv.innerText = this.message;
+        messageDiv.textContent = this.message;
         item.appendChild(messageDiv);
 
         var urlDiv = document.createElement("div");
         urlDiv.className = "console-message-url";
-        urlDiv.innerText = this.url;
+        urlDiv.textContent = this.url;
         item.appendChild(urlDiv);
 
         if (this.line) {
             var lineDiv = document.createElement("div");
             lineDiv.className = "console-message-line";
-            lineDiv.innerText = this.line;
+            lineDiv.textContent = this.line;
             item.appendChild(lineDiv);
         }
 
@@ -364,7 +364,7 @@ WebInspector.ConsoleCommand.prototype = {
 
         var inputDiv = document.createElement("div");
         inputDiv.className = "console-command-input";
-        inputDiv.innerText = this.input;
+        inputDiv.textContent = this.input;
         item.appendChild(inputDiv);
 
         var outputDiv = document.createElement("div");
index e40b54c..1c8f990 100644 (file)
@@ -28,7 +28,7 @@
 
 WebInspector.DatabasePanel = function(database, views)
 {
-    var allViews = [{ title: "Query" }, { title: "Browse" }];
+    var allViews = [{ title: WebInspector.UIString("Query"), name: "query" }, { title: WebInspector.UIString("Browse"), name: "browse" }];
     if (views)
         allViews = allViews.concat(views);
 
@@ -68,7 +68,7 @@ WebInspector.DatabasePanel = function(database, views)
     browseView.reloadTableElement = document.createElement("button");
     browseView.reloadTableElement.appendChild(document.createElement("img"));
     browseView.reloadTableElement.className = "database-table-reload";
-    browseView.reloadTableElement.title = "Reload";
+    browseView.reloadTableElement.title = WebInspector.UIString("Reload");
     browseView.reloadTableElement.addEventListener("click", function() { panel.updateTableList(); panel.updateTableBrowser() }, false);
 
     browseView.show = function()
@@ -218,12 +218,12 @@ return {
             if (!result.errorCode) {
                 var emptyMsgElement = document.createElement("div");
                 emptyMsgElement.className = "database-table-empty";
-                emptyMsgElement.innerHTML = "The <q>" + this.currentTable + "</q><br>table is empty.";
+                emptyMsgElement.textContent = WebInspector.UIString("The “%@”\ntable is empty.", this.currentTable);
                 this.views.browse.contentElement.appendChild(emptyMsgElement);
             } else {
                 var errorMsgElement = document.createElement("div");
                 errorMsgElement.className = "database-table-error";
-                errorMsgElement.innerHTML = "An error occurred trying to<br>read the <q>" + this.currentTable + "</q> table.";
+                errorMsgElement.textContent = WebInspector.UIString("An error occurred trying to\nread the “%@” table.", this.currentTable);
                 this.views.browse.contentElement.appendChild(errorMsgElement);
             }
         }
@@ -271,10 +271,10 @@ return {
                 resultDiv.textContent = result.error;
             } else if (result.errorCode == 2) {
                 resultDiv.className += " error";
-                resultDiv.textContent = "Database no longer has expected version.";
+                resultDiv.textContent = WebInspector.UIString("Database no longer has expected version.");
             } else {
                 resultDiv.className += " error";
-                resultDiv.textContent = "An unexpected error " + result.errorCode + " occured.";
+                resultDiv.textContent = WebInspector.UIString("An unexpected error %@ occured.", result.errorCode);
             }
         }
 
index 372991c..822384c 100644 (file)
@@ -28,7 +28,7 @@
 
 WebInspector.DocumentPanel = function(resource, views)
 {
-    var allViews = [{ title: "DOM" }];
+    var allViews = [{ title: WebInspector.UIString("DOM"), name: "dom" }];
     if (views)
         allViews = allViews.concat(views);
 
@@ -342,9 +342,9 @@ WebInspector.DocumentPanel.prototype = {
 
                 case Node.TEXT_NODE:
                     if (isNodeWhitespace.call(current))
-                        crumbTitle = "(whitespace)";
+                        crumbTitle = WebInspector.UIString("(whitespace)");
                     else
-                        crumbTitle = "(text)";
+                        crumbTitle = WebInspector.UIString("(text)");
                     break
 
                 case Node.COMMENT_NODE:
index b6fde59..402b754 100644 (file)
@@ -54,9 +54,9 @@ WebInspector.ImagePanel = function(resource)
     infoListElement.className = "infoList";
 
     var imageProperties = [
-        { name: "Dimensions", value: this.imagePreviewElement.naturalWidth + " \u00D7 " + this.imagePreviewElement.height },
-        { name: "File size", value: (this.resource.contentLength / 1024).toPrecision(2) + "KB" },
-        { name: "MIME type", value: this.resource.mimeType }
+        { name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", this.imagePreviewElement.naturalWidth, this.imagePreviewElement.height) },
+        { name: WebInspector.UIString("File size"), value: WebInspector.UIString("%.2fKB", (this.resource.contentLength / 1024)) },
+        { name: WebInspector.UIString("MIME type"), value: this.resource.mimeType }
     ];
 
     var listHTML = '';
index cb52e3f..e805560 100644 (file)
@@ -28,7 +28,7 @@
 
 WebInspector.MetricsSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, "Metrics");
+    WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics"));
 }
 
 WebInspector.MetricsSidebarPane.prototype = {
@@ -80,6 +80,7 @@ WebInspector.MetricsSidebarPane.prototype = {
         };
 
         var boxes = ["content", "padding", "border", "margin"];
+        var boxLabels = [WebInspector.UIString("content"), WebInspector.UIString("padding"), WebInspector.UIString("border"), WebInspector.UIString("margin")];
         var previousBox;
         for (var i = 0; i < boxes.length; ++i) {
             var name = boxes[i];
@@ -101,7 +102,7 @@ WebInspector.MetricsSidebarPane.prototype = {
 
                 var labelElement = document.createElement("div");
                 labelElement.className = "label";
-                labelElement.textContent = name;
+                labelElement.textContent = boxLabels[i];
                 boxElement.appendChild(labelElement);
 
                 var topElement = document.createElement("div");
index 6be5fe2..63419f0 100644 (file)
@@ -65,13 +65,13 @@ WebInspector.NetworkPanel = function()
     this.graphLabelElement.appendChild(document.createElement("br"));
 
     var sizeOptionElement = document.createElement("option");
-    sizeOptionElement.textContent = "Transfer Size";
     sizeOptionElement.calculator = new WebInspector.TransferSizeCalculator();
+    sizeOptionElement.textContent = sizeOptionElement.calculator.title;
     this.graphModeSelectElement.appendChild(sizeOptionElement);
 
     var timeOptionElement = document.createElement("option");
-    timeOptionElement.textContent = "Transfer Time";
     timeOptionElement.calculator = new WebInspector.TransferTimeCalculator();
+    timeOptionElement.textContent = timeOptionElement.calculator.title;
     this.graphModeSelectElement.appendChild(timeOptionElement);
 
     var graphSideElement = document.createElement("div");
@@ -413,8 +413,8 @@ WebInspector.NetworkPanel.prototype = {
 
         var graphInfo = this.calculator.computeValues(this.timelineEntries);
 
-        var categoryOrder = ["documents", "stylesheets", "images", "scripts", "other"];
-        var categoryColors = {documents: {r: 47, g: 102, b: 236}, stylesheets: {r: 157, g: 231, b: 119}, images: {r: 164, g: 60, b: 255}, scripts: {r: 255, g: 121, b: 0}, other: {r: 186, g: 186, b: 186}};
+        var categoryOrder = ["documents", "stylesheets", "images", "fonts", "scripts", "other"];
+        var categoryColors = {documents: {r: 47, g: 102, b: 236}, stylesheets: {r: 157, g: 231, b: 119}, images: {r: 164, g: 60, b: 255}, fonts: {r: 255, g: 10, b: 10}, scripts: {r: 255, g: 121, b: 0}, other: {r: 186, g: 186, b: 186}};
         var fillSegments = [];
 
         this.legendElement.removeChildren();
@@ -422,7 +422,7 @@ WebInspector.NetworkPanel.prototype = {
         if (this.totalLegendLabel)
             this.totalLegendLabel.parentNode.removeChild(this.totalLegendLabel);
 
-        this.totalLegendLabel = this.makeLegendElement(this.calculator.title, this.calculator.formatValue(graphInfo.total));
+        this.totalLegendLabel = this.makeLegendElement(this.calculator.totalTitle, this.calculator.formatValue(graphInfo.total));
         this.totalLegendLabel.addStyleClass("network-graph-legend-total");
         this.graphLabelElement.appendChild(this.totalLegendLabel);
 
@@ -438,7 +438,7 @@ WebInspector.NetworkPanel.prototype = {
             var fillSegment = {color: colorString, value: size};
             fillSegments.push(fillSegment);
 
-            var legendLabel = this.makeLegendElement(category, this.calculator.formatValue(size), colorString);
+            var legendLabel = this.makeLegendElement(WebInspector.resourceCategories[category].title, this.calculator.formatValue(size), colorString);
             this.legendElement.appendChild(legendLabel);
         }
 
@@ -562,7 +562,7 @@ WebInspector.NetworkTimelineEntry.prototype = {
             this.barElement.style.right = "0px";
         }
 
-        this.barElement.className = "network-bar network-category-" + this.resource.category.title;
+        this.barElement.className = "network-bar network-category-" + this.resource.category.name;
 
         if (this.infoNeedsRefresh)
             this.refreshInfo();
@@ -586,8 +586,8 @@ WebInspector.NetworkTimelineEntry.prototype = {
         this.infoElement.removeChildren();
 
         var sections = [
-            {title: "Request", info: this.resource.sortedRequestHeaders},
-            {title: "Response", info: this.resource.sortedResponseHeaders}
+            {title: WebInspector.UIString("Request"), info: this.resource.sortedRequestHeaders},
+            {title: WebInspector.UIString("Response"), info: this.resource.sortedResponseHeaders}
         ];
 
         function createSectionTable(section) {
@@ -598,7 +598,8 @@ WebInspector.NetworkTimelineEntry.prototype = {
             this.infoElement.appendChild(table);
 
             var heading = document.createElement("th");
-            heading.innerText = section.title;
+            heading.textContent = section.title;
+
             var row = table.createTHead().insertRow(-1).appendChild(heading);
             var body = document.createElement("tbody");
             table.appendChild(body);
@@ -606,9 +607,9 @@ WebInspector.NetworkTimelineEntry.prototype = {
             section.info.forEach(function(header) {
                 var row = body.insertRow(-1);
                 var th = document.createElement("th");
-                th.innerText = header.header;
+                th.textContent = header.header;
                 row.appendChild(th);
-                row.insertCell(-1).innerText = header.value;
+                row.insertCell(-1).textContent = header.value;
             });
         }
         sections.forEach(createSectionTable, this);
@@ -722,9 +723,9 @@ WebInspector.TimelineValueCalculator.prototype = {
             if (value === undefined)
                 return;
 
-            if (!(entry.resource.category in categoryValues))
-                categoryValues[entry.resource.category] = 0;
-            categoryValues[entry.resource.category] += value;
+            if (!(entry.resource.category.name in categoryValues))
+                categoryValues[entry.resource.category.name] = 0;
+            categoryValues[entry.resource.category.name] += value;
             total += value;
         }
         entries.forEach(compute, this);
@@ -758,9 +759,9 @@ WebInspector.TransferTimeCalculator.prototype = {
     {
         var entriesByCategory = {};
         entries.forEach(function(entry) {
-            if (!(entry.resource.category in entriesByCategory))
-                entriesByCategory[entry.resource.category] = [];
-            entriesByCategory[entry.resource.category].push(entry);
+            if (!(entry.resource.category.name in entriesByCategory))
+                entriesByCategory[entry.resource.category.name] = [];
+            entriesByCategory[entry.resource.category.name].push(entry);
         });
 
         var earliestStart;
@@ -805,7 +806,12 @@ WebInspector.TransferTimeCalculator.prototype = {
 
     get title()
     {
-        return "Transfer Time";
+        return WebInspector.UIString("Transfer Time");
+    },
+
+    get totalTitle()
+    {
+        return WebInspector.UIString("Total Time");
     },
 
     formatValue: function(value)
@@ -829,7 +835,12 @@ WebInspector.TransferSizeCalculator.prototype = {
 
     get title()
     {
-        return "Transfer Size";
+        return WebInspector.UIString("Transfer Size");
+    },
+
+    get totalTitle()
+    {
+        return WebInspector.UIString("Total Size");
     },
 
     formatValue: function(value)
index 0090021..1994d40 100644 (file)
@@ -48,15 +48,15 @@ WebInspector.Panel = function(views)
             view.panel = this;
 
             view.buttonElement = document.createElement("button");
-            view.buttonElement.setAttribute("title", view.title);
+            view.buttonElement.title = view.title;
             view.buttonElement.addEventListener("click", selectViewFunction, false);
             view.buttonElement.appendChild(document.createElement("img"));
             view.buttonElement.view = view;
 
             view.contentElement = document.createElement("div");
-            view.contentElement.className = "content " + view.title.toLowerCase();
+            view.contentElement.className = "content " + view.name;
 
-            this.views[view.title.toLowerCase()] = view;
+            this.views[view.name] = view;
             this.viewButtons.push(view.buttonElement);
             this.element.appendChild(view.contentElement);
         }
index b3448e1..b6da584 100644 (file)
@@ -28,7 +28,7 @@
 
 WebInspector.PropertiesSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, "Properties");
+    WebInspector.SidebarPane.call(this, WebInspector.UIString("Properties"));
 }
 
 WebInspector.PropertiesSidebarPane.prototype = {
@@ -59,7 +59,7 @@ WebInspector.ObjectPropertiesSection = function(object)
     var subtitle;
     if (title.match(/Prototype$/)) {
         title = title.replace(/Prototype$/, "");
-        subtitle = "Prototype";
+        subtitle = WebInspector.UIString("Prototype");
     }
 
     this.object = object;
index 7fb0a48..0f9cb8c 100644 (file)
@@ -64,20 +64,20 @@ WebInspector.Resource.Type = {
     {
         switch (type) {
             case this.Document:
-                return "document";
+                return WebInspector.UIString("document");
             case this.Stylesheet:
-                return "stylesheet";
+                return WebInspector.UIString("stylesheet");
             case this.Image:
-                return "image";
+                return WebInspector.UIString("image");
             case this.Font:
-                return "font";
+                return WebInspector.UIString("font");
             case this.Script:
-                return "script";
+                return WebInspector.UIString("script");
             case this.Other:
             default:
-                return "other";
+                return WebInspector.UIString("other");
         }
-    },
+    }
 }
 
 WebInspector.Resource.prototype = {
index dd123d1..a2f2ba4 100644 (file)
@@ -26,8 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceCategory = function(title)
+WebInspector.ResourceCategory = function(title, name)
 {
+    this.name = name;
     this.title = title;
     this.resources = [];
     this.listItem = new WebInspector.ResourceCategoryTreeElement(this);
index 7fba529..f676142 100644 (file)
@@ -28,7 +28,7 @@
 
 WebInspector.SourcePanel = function(resource, views)
 {
-    var allViews = [{ title: "Source" }];
+    var allViews = [{ title: WebInspector.UIString("Source"), name: "source" }];
     if (views)
         allViews = allViews.concat(views);
 
index 8e20677..820da6d 100644 (file)
@@ -28,7 +28,7 @@
 
 WebInspector.StylesSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, "Styles");
+    WebInspector.SidebarPane.call(this, WebInspector.UIString("Styles"));
 }
 
 WebInspector.StylesSidebarPane.prototype = {
@@ -71,14 +71,14 @@ WebInspector.StylesSidebarPane.prototype = {
             }
         } else {
             var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
-            styleRules.push({ computedStyle: true, selectorText: "Computed Style", style: computedStyle, editable: false });
+            styleRules.push({ computedStyle: true, selectorText: WebInspector.UIString("Computed Style"), style: computedStyle, editable: false });
 
             var nodeName = node.nodeName.toLowerCase();
             for (var i = 0; i < node.attributes.length; ++i) {
                 var attr = node.attributes[i];
                 if (attr.style) {
                     var attrStyle = { style: attr.style, editable: false };
-                    attrStyle.subtitle = "element\u2019s \u201C" + attr.name + "\u201D attribute";
+                    attrStyle.subtitle = WebInspector.UIString("element’s “%@” attribute", attr.name);
                     attrStyle.selectorText = nodeName + "[" + attr.name;
                     if (attr.value.length)
                         attrStyle.selectorText += "=" + attr.value;
@@ -88,8 +88,8 @@ WebInspector.StylesSidebarPane.prototype = {
             }
 
             if (node.style && node.style.length) {
-                var inlineStyle = { selectorText: "Inline Style Attribute", style: node.style };
-                inlineStyle.subtitle = "element\u2019s \u201Cstyle\u201D attribute";
+                var inlineStyle = { selectorText: WebInspector.UIString("Inline Style Attribute"), style: node.style };
+                inlineStyle.subtitle = WebInspector.UIString("element’s “%@” attribute", "style");
                 styleRules.push(inlineStyle);
             }
 
@@ -245,7 +245,7 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl
         showInheritedLabel.addEventListener("click", showInheritedToggleFunction, false);
 
         showInheritedLabel.appendChild(showInheritedInput);
-        showInheritedLabel.appendChild(document.createTextNode("Show inherited properties"));
+        showInheritedLabel.appendChild(document.createTextNode(WebInspector.UIString("Show inherited properties")));
         this.subtitleElement.appendChild(showInheritedLabel);
     } else {
         if (!subtitle) {
@@ -254,9 +254,9 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl
                 subtitle = WebInspector.linkifyURL(url, url.trimURL(WebInspector.mainResource.domain).escapeHTML());
                 this.subtitleElement.addStyleClass("file");
             } else if (this.styleRule.parentStyleSheet && !this.styleRule.parentStyleSheet.ownerNode)
-                subtitle = "user agent stylesheet";
+                subtitle = WebInspector.UIString("user agent stylesheet");
             else
-                subtitle = "inline stylesheet";
+                subtitle = WebInspector.UIString("inline stylesheet");
         }
 
         this.subtitle = subtitle;
index 9be2039..c43776d 100644 (file)
@@ -1508,7 +1508,7 @@ body:not(.inactive) .focused .outline-disclosure li.selected * {
     border: none;
 }
 
-.browse.content .database-table-empty {
+.browse.content .database-table-empty, .browse.content .database-table-error {
     position: absolute;
     top: 0;
     bottom: 25%;
@@ -1523,22 +1523,11 @@ body:not(.inactive) .focused .outline-disclosure li.selected * {
     text-align: center;
     font-weight: bold;
     padding: 10px;
+    white-space: pre-wrap;
 }
 
 .browse.content .database-table-error {
-    position: absolute;
-    top: 0;
-    bottom: 25%;
-    left: 0;
-    right: 0;
-    font-size: 24px;
     color: rgb(66%, 33%, 33%);
-    margin-top: auto;
-    margin-bottom: auto;
-    height: 50px;
-    line-height: 26px;
-    text-align: center;
-    padding: 10px;
 }
 
 .database-browse-table {
index cf80ad9..4c9d641 100644 (file)
@@ -29,7 +29,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-    <title>Web Inspector</title>
     <script type="text/javascript" src="utilities.js"></script>
     <script type="text/javascript" src="treeoutline.js"></script>
     <script type="text/javascript" src="inspector.js"></script>
@@ -56,7 +55,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <div id="toolbar">
         <button id="back" class="split-button first"><img></button><img class="split-button-divider"><button id="forward" class="split-button last"><img></button>
         <span id="toolbarButtons"></span>
-        <input id="search" type="search" autosave="inspectorSearch" results="20" placeholder="Search" incremental="incremental" onsearch="WebInspector.performSearch(this.value)">
+        <input id="search" type="search" autosave="inspectorSearch" results="20" incremental="incremental" onsearch="WebInspector.performSearch(this.value)">
     </div>
     <div id="sidebar" class="focusable focused">
         <ol id="list"></ol>
index c635d30..64c05f1 100644 (file)
@@ -33,6 +33,7 @@ var Preferences = {
     maxInlineTextChildLength: 80,
     maxTextSearchResultLength: 80,
     showInheritedComputedStyleProperties: false,
+    showMissingLocalizedStrings: false,
     toolbarHeight: 28
 }
 
@@ -41,6 +42,8 @@ var WebInspector = {
     resourceURLMap: {},
     backForwardList: [],
     searchResultsHeight: 100,
+    localizedStrings: {},
+    missingLocalizedStrings: {},
 
     get consolePanel()
     {
@@ -205,7 +208,18 @@ var WebInspector = {
     }
 }
 
-WebInspector.loaded = function(event)
+WebInspector.setupLocalizedString = function(event)
+{
+    var localizedStringsURL = InspectorController.localizedStringsURL();
+    if (localizedStringsURL) {
+        var localizedStringsScriptElement = document.createElement("script");
+        localizedStringsScriptElement.type = "text/javascript";
+        localizedStringsScriptElement.src = localizedStringsURL;
+        document.getElementsByTagName("head").item(0).appendChild(localizedStringsScriptElement);
+    }
+}
+
+WebInspector.loaded = function()
 {
     this.fileOutline = new TreeOutline(document.getElementById("list"));
     this.fileOutline.expandTreeElementsWhenArrowing = true;
@@ -214,23 +228,27 @@ WebInspector.loaded = function(event)
     this.statusOutline.expandTreeElementsWhenArrowing = true;
 
     this.resourceCategories = {
-        documents: new WebInspector.ResourceCategory("documents"),
-        stylesheets: new WebInspector.ResourceCategory("stylesheets"),
-        images: new WebInspector.ResourceCategory("images"),
-        scripts: new WebInspector.ResourceCategory("scripts"),
-        fonts: new WebInspector.ResourceCategory("fonts"),
-        databases: new WebInspector.ResourceCategory("databases"),
-        other: new WebInspector.ResourceCategory("other")
+        documents: new WebInspector.ResourceCategory(WebInspector.UIString("documents"), "documents"),
+        stylesheets: new WebInspector.ResourceCategory(WebInspector.UIString("stylesheets"), "stylesheets"),
+        images: new WebInspector.ResourceCategory(WebInspector.UIString("images"), "images"),
+        scripts: new WebInspector.ResourceCategory(WebInspector.UIString("scripts"), "scripts"),
+        fonts: new WebInspector.ResourceCategory(WebInspector.UIString("fonts"), "fonts"),
+        databases: new WebInspector.ResourceCategory(WebInspector.UIString("databases"), "databases"),
+        other: new WebInspector.ResourceCategory(WebInspector.UIString("other"), "other")
+    };
+
+    this.Tips = {
+        ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could save bandwidth by having your web server compress this transfer with gzip or zlib.")}
+    };
+
+    this.Warnings = {
+        IncorrectMIMEType: {id: 0, message: WebInspector.UIString("Resource interpreted as %@ but transferred with MIME type %@.")}
     };
 
-    this.consoleListItem = new WebInspector.ConsoleStatusTreeElement();
-    this.consoleListItem.item.onselect = function(element) { WebInspector.StatusTreeElement.selected(element); WebInspector.navigateToPanel(WebInspector.consolePanel) };
-    this.consoleListItem.item.ondeselect = function(element) { WebInspector.consolePanel.hide() };
-    this.statusOutline.appendChild(this.consoleListItem.item);
+    this.consoleListItem = new WebInspector.ConsoleStatusTreeElement(WebInspector.consolePanel);
+    this.statusOutline.appendChild(this.consoleListItem);
 
-    this.networkListItem = new WebInspector.StatusTreeElement("Network");
-    this.networkListItem.onselect = function(element) { WebInspector.StatusTreeElement.selected(element); WebInspector.navigateToPanel(WebInspector.networkPanel); };
-    this.networkListItem.ondeselect = function(element) { WebInspector.networkPanel.hide() };
+    this.networkListItem = new WebInspector.StatusTreeElement(WebInspector.UIString("Network"), "network", WebInspector.networkPanel);
     this.statusOutline.appendChild(this.networkListItem);
 
     this.resourceCategories.documents.listItem.expand();
@@ -248,8 +266,10 @@ WebInspector.loaded = function(event)
     document.addEventListener("beforecopy", function(event) { WebInspector.documentCanCopy(event) }, true);
     document.addEventListener("copy", function(event) { WebInspector.documentCopy(event) }, true);
 
-    document.getElementById("back").title = "Show previous panel.";
-    document.getElementById("forward").title = "Show next panel.";
+    document.getElementById("back").title = WebInspector.UIString("Show previous panel.");
+    document.getElementById("forward").title = WebInspector.UIString("Show next panel.");
+
+    document.getElementById("search").setAttribute("placeholder", WebInspector.UIString("Search"));
 
     document.getElementById("back").addEventListener("click", function(event) { WebInspector.back() }, true);
     document.getElementById("forward").addEventListener("click", function(event) { WebInspector.forward() }, true);
@@ -263,13 +283,22 @@ WebInspector.loaded = function(event)
 
     document.body.addStyleClass("detached");
 
-    window.removeEventListener("load", this.loaded, false);
-    delete this.loaded;
-
     InspectorController.loaded();
 }
 
-window.addEventListener("load", function(event) { WebInspector.loaded(event) }, false);
+var windowLoaded = function()
+{
+    WebInspector.setupLocalizedString(event);
+
+    // Delay calling loaded to give time for the localized strings file to load.
+    // Calling it too early will cause localized string lookups to fail.
+    setTimeout(function() { WebInspector.loaded() }, 0);
+
+    delete windowLoaded;
+    window.removeEventListener("load", windowLoaded, false);
+};
+
+window.addEventListener("load", windowLoaded, false);
 
 WebInspector.windowUnload = function(event)
 {
@@ -589,7 +618,7 @@ WebInspector.dividerDragEnd = function(element, dividerDrag, dividerDragEnd, eve
 WebInspector.back = function()
 {
     if (this.currentBackForwardIndex <= 0) {
-        alert("Can't go back from index " + this.currentBackForwardIndex);
+        console.error("Can't go back from index " + this.currentBackForwardIndex);
         return;
     }
 
@@ -599,7 +628,7 @@ WebInspector.back = function()
 WebInspector.forward = function()
 {
     if (this.currentBackForwardIndex >= this.backForwardList.length - 1) {
-        alert("Can't go forward from index " + this.currentBackForwardIndex);
+        console.error("Can't go forward from index " + this.currentBackForwardIndex);
         return;
     }
 
@@ -921,7 +950,7 @@ WebInspector.performSearch = function(query)
 
                 var title = "<div class=\"selection selected\"></div>";
                 if (j == 0)
-                    title += "<div class=\"search-results-section\">Source</div>";
+                    title += "<div class=\"search-results-section\">" + WebInspector.UIString("Source") + "</div>";
                 title += beforeText.escapeHTML() + "<span class=\"search-matched-string\">" + text.escapeHTML() + "</span>" + afterText.escapeHTML();
                 var item = new TreeElement(title, {panel: file.resource.panel, line: line, range: range}, false);
                 item.onselect = sourceResultSelected;
@@ -934,7 +963,7 @@ WebInspector.performSearch = function(query)
                 var node = file.domResults[j];
                 var title = "<div class=\"selection selected\"></div>";
                 if (j == 0)
-                    title += "<div class=\"search-results-section\">DOM</div>";
+                    title += "<div class=\"search-results-section\">" + WebInspector.UIString("DOM") + "</div>";
                 title += nodeTitleInfo.call(node).title;
                 var item = new TreeElement(title, {panel: file.resource.panel, node: node}, false);
                 item.onselect = domResultSelected;
@@ -970,23 +999,51 @@ WebInspector.navigateToPanel = function(panel, view, fromBackForwardAction)
         panel.currentView = view;
 }
 
-WebInspector.StatusTreeElement = function(title)
+WebInspector.UIString = function(string)
 {
-    var item = new TreeElement("<span class=\"title only\">" + title + "</span><span class=\"icon " + title.toLowerCase() + "\"></span>", {}, false);
-    item.onselect = WebInspector.StatusTreeElement.selected;
-    return item;
+    if (string in this.localizedStrings)
+        string = this.localizedStrings[string];
+    else {
+        if (!(string in this.missingLocalizedStrings)) {
+            console.error("Localized string \"" + string + "\" not found.");
+            this.missingLocalizedStrings[string] = true;
+        }
+
+        if (Preferences.showMissingLocalizedStrings)
+            string += " (not localized)";
+    }
+
+    return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
 }
 
-WebInspector.StatusTreeElement.selected = function(element)
+WebInspector.StatusTreeElement = function(title, iconClass, panel)
 {
-    var selectedElement = WebInspector.fileOutline.selectedTreeElement;
-    if (selectedElement)
-        selectedElement.deselect();
+    TreeElement.call(this, "<span class=\"title only\">" + title + "</span><span class=\"icon " + iconClass + "\"></span>", null, false);
+    this.panel = panel;
 }
 
-WebInspector.ConsoleStatusTreeElement = function()
+WebInspector.StatusTreeElement.prototype = {
+    onselect: function()
+    {
+        var selectedElement = WebInspector.fileOutline.selectedTreeElement;
+        if (selectedElement)
+            selectedElement.deselect();
+        if (this.panel)
+            WebInspector.navigateToPanel(this.panel);
+    },
+
+    ondeselect: function()
+    {
+        if (this.panel)
+            this.panel.hide();
+    }
+}
+
+WebInspector.StatusTreeElement.prototype.__proto__ = TreeElement.prototype;
+
+WebInspector.ConsoleStatusTreeElement = function(panel)
 {
-    this.item = WebInspector.StatusTreeElement.call(this, "Console");
+    WebInspector.StatusTreeElement.call(this, WebInspector.UIString("Console"), "console", panel);
 }
 
 WebInspector.ConsoleStatusTreeElement.prototype = {
@@ -1031,7 +1088,7 @@ WebInspector.ConsoleStatusTreeElement.prototype = {
         var title = "<span class=\"title";
         if (!this.warnings && !this.errors)
             title += " only";
-        title += "\">Console</span><span class=\"icon console\"></span>";
+        title += "\">" + WebInspector.UIString("Console") + "</span><span class=\"icon console\"></span>";
 
         if (this.warnings || this.errors) {
             title += "<span class=\"info\">";
@@ -1050,20 +1107,12 @@ WebInspector.ConsoleStatusTreeElement.prototype = {
             title += "</span>";
         }
 
-        this.item.title = title;
+        this.title = title;
     }
 }
 
 WebInspector.ConsoleStatusTreeElement.prototype.__proto__ = WebInspector.StatusTreeElement.prototype;
 
-WebInspector.Tips = {
-    ResourceNotCompressed: {id: 0, message: "You could save bandwidth by having your web server compress this transfer with gzip or zlib."}
-}
-
-WebInspector.Warnings = {
-    IncorrectMIMEType: {id: 0, message: "Resource interpreted as %s but transferred with MIME type %s."}
-}
-
 // This table maps MIME types to the Resource.Types which are valid for them.
 // The following line:
 //    "text/html":                {0: 1},
index 0f090b5..f6cc442 100644 (file)
@@ -263,7 +263,7 @@ public:
     virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) { return ObjectContentType(); }
     virtual String overrideMediaType() const { return String(); }
 
-    virtual void redirectDataToPlugin(WebCore::Widget*) {}
+    virtual void redirectDataToPlugin(Widget*) {}
     virtual void windowObjectCleared() {}
     virtual void didPerformFirstNavigation() const {}
 
@@ -397,7 +397,9 @@ public:
 
     virtual void inspectorDestroyed() {};
 
-    virtual WebCore::Page* createPage() { return 0; };
+    virtual Page* createPage() { return 0; };
+
+    virtual String localizedStringsURL() { return String(); };
 
     virtual void showWindow() {};
     virtual void closeWindow() {};
@@ -405,9 +407,9 @@ public:
     virtual void attachWindow() {};
     virtual void detachWindow() {};
 
-    virtual void highlight(WebCore::Node*) {};
+    virtual void highlight(Node*) {};
     virtual void hideHighlight() {};
-    virtual void inspectedURLChanged(const WebCore::String& newURL) {};
+    virtual void inspectedURLChanged(const String& newURL) {};
 };
     
 }
index 1dedf72..0ae59bd 100644 (file)
@@ -1,3 +1,16 @@
+2007-11-17  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        Bug 13470: i18n: The Web Inspector is not localizable
+        http://bugs.webkit.org/show_bug.cgi?id=13470
+
+        Update the localized strings and the file encoding of WebInspectorClient.mm.
+
+        * English.lproj/Localizable.strings:
+        * StringsNotToBeLocalized.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2007-11-16  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Tim Hatcher.
index a63e904..a61ee31 100644 (file)
Binary files a/WebKit/English.lproj/Localizable.strings and b/WebKit/English.lproj/Localizable.strings differ
index c8a9cb9..1eda809 100644 (file)
 "Times"
 "ToggleBold"
 "ToggleItalic"
-"U+000009"
-"U+00001B"
+"U+0009"
+"U+001B"
 "UTF-8"
 "UseBackForwardList"
 "User-Agent"
 "WebAuthenticationPanel"
 "WebBackForwardList:\n"
 "WebDataRequest"
+"WebDatabaseDidModifyDatabaseNotification"
+"WebDatabaseDidModifyOriginNotification"
 "WebDatabaseDirectory"
-"WebDatabaseNameKey"
-"WebDatabaseSizeKey"
+"WebDatabaseDisplayNameKey"
+"WebDatabaseExpectedSizeKey"
+"WebDatabaseUsageKey"
 "WebElementDOMNode"
 "WebElementFrame"
 "WebElementImage"
@@ -501,24 +504,22 @@ WebKit/mac/WebCoreSupport/WebChromeClient.mm:"fullscreen"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"height"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"menuBarVisible"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"message"
-WebKit/mac/WebCoreSupport/WebChromeClient.mm:"preferredType"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"resizable"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"scrollbarsVisible"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"statusBarVisible"
-WebKit/mac/WebCoreSupport/WebChromeClient.mm:"tab"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"toolBarVisible"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"width"
-WebKit/mac/WebCoreSupport/WebChromeClient.mm:"window"
 WebKit/mac/WebCoreSupport/WebChromeClient.mm:"y"
 WebKit/mac/WebCoreSupport/WebEditorClient.mm:"Down"
 WebKit/mac/WebCoreSupport/WebEditorClient.mm:"Enter"
 WebKit/mac/WebCoreSupport/WebEditorClient.mm:"Up"
 WebKit/mac/WebCoreSupport/WebFrameBridge.mm:"height"
 WebKit/mac/WebCoreSupport/WebFrameBridge.mm:"width"
-WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"Web Inspector %C %@"
+WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"InspectorLocalizedStrings"
 WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"Web Inspector 2"
 WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"inspector"
 WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"inspector/Images"
+WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"js"
 WebKit/mac/WebInspector/WebNodeHighlightView.m:"display"
 WebKit/mac/WebInspector/WebNodeHighlightView.m:"inline"
 WebKit/mac/WebView/WebHTMLView.mm:"'%@'"
index c5f9372..0ef1e85 100644 (file)
                065AD5A10B0C32C7005A2B1D /* WebContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebContextMenuClient.h; sourceTree = "<group>"; };
                065AD5A20B0C32C7005A2B1D /* WebContextMenuClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuClient.mm; sourceTree = "<group>"; };
                06693DDA0BFBA85200216072 /* WebInspectorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspectorClient.h; sourceTree = "<group>"; };
-               06693DDB0BFBA85200216072 /* WebInspectorClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorClient.mm; sourceTree = "<group>"; };
+               06693DDB0BFBA85200216072 /* WebInspectorClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorClient.mm; sourceTree = "<group>"; };
                14D8252D0AF955090004F057 /* WebChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebChromeClient.h; sourceTree = "<group>"; };
                14D8252E0AF955090004F057 /* WebChromeClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebChromeClient.mm; sourceTree = "<group>"; };
                1C0706620A431E01001078F6 /* WebScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugServer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
index 10cf5e9..8f827cb 100644 (file)
@@ -1,3 +1,14 @@
+2007-11-17  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        Bug 13470: i18n: The Web Inspector is not localizable
+        http://bugs.webkit.org/show_bug.cgi?id=13470
+
+        * WebCoreSupport/InspectorClientGtk.cpp:
+        (WebKit::InspectorClient::localizedStringsURL): Empty stub.
+        * WebCoreSupport/InspectorClientGtk.h: Add localizedStringsURL.
+
 2007-11-13  Mark Rowe  <mrowe@apple.com>
 
         Gtk build fix. Replace incorrect use of the LOG macro with g_print.
index d42fdb6..f20b9ea 100644 (file)
@@ -46,6 +46,12 @@ Page* InspectorClient::createPage()
     return 0;
 }
 
+String InspectorClient::localizedStringsURL()
+{
+    notImplemented();
+    return String();
+}
+
 void InspectorClient::showWindow()
 {
     notImplemented();
index 4c1885e..4630076 100644 (file)
@@ -45,6 +45,8 @@ namespace WebKit {
 
         virtual WebCore::Page* createPage();
 
+        virtual WebCore::String localizedStringsURL();
+
         virtual void showWindow();
         virtual void closeWindow();
 
index f7ce08f..614ad32 100644 (file)
@@ -1,3 +1,20 @@
+2007-11-17  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        Bug 13470: i18n: The Web Inspector is not localizable
+        http://bugs.webkit.org/show_bug.cgi?id=13470
+
+        Implement the localizedStringsURL() client method to return the
+        localized URL of InspectorLocalizedStrings.js in WebCore.
+
+        * WebCoreSupport/WebInspectorClient.h: Added localizedStringsURL.
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorClient::localizedStringsURL): Added.
+        (WebInspectorClient::updateWindowTitle): Localized the window title.
+        (-[WebInspectorWindowController init]): Remove a FIXME that dosen't make sense anymore.
+        (-[WebInspectorWindowController initWithInspectedWebView:]): Code style cleanup.
+
 2007-11-17  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 6396dbe..45cd1f9 100644 (file)
@@ -41,6 +41,7 @@ public:
     virtual void inspectorDestroyed();
 
     virtual WebCore::Page* createPage();
+    virtual WebCore::String localizedStringsURL();
 
     virtual void showWindow();
     virtual void closeWindow();
index c3c02f6..19f3b7c 100644 (file)
 
 #import "WebFrameInternal.h"
 #import "WebFrameView.h"
+#import "WebLocalizableStrings.h"
 #import "WebNodeHighlight.h"
 #import "WebPreferences.h"
 #import "WebView.h"
 #import "WebViewInternal.h"
 #import "WebViewPrivate.h"
+
 #import <AppKit/NSWindowController.h>
+
 #import <WebCore/InspectorController.h>
 #import <WebCore/Page.h>
+
 #import <WebKit/DOMCore.h>
 #import <WebKit/DOMExtensions.h>
 
@@ -85,6 +89,14 @@ Page* WebInspectorClient::createPage()
     return core([m_windowController.get() webView]);
 }
 
+String WebInspectorClient::localizedStringsURL()
+{
+    NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"InspectorLocalizedStrings" ofType:@"js"];
+    if (path)
+        return [[NSURL fileURLWithPath:path] absoluteString];
+    return String();
+}
+
 void WebInspectorClient::showWindow()
 {
     updateWindowTitle();
@@ -124,7 +136,8 @@ void WebInspectorClient::inspectedURLChanged(const String& newURL)
 
 void WebInspectorClient::updateWindowTitle() const
 {
-    [[m_windowController.get() window] setTitle:[NSString stringWithFormat:@"Web Inspector %C %@", 0x2014, (NSString *)m_inspectedURL]];
+    NSString *title = [NSString stringWithFormat:UI_STRING("Web Inspector — %@", "Web Inspector window title"), (NSString *)m_inspectedURL];
+    [[m_windowController.get() window] setTitle:title];
 }
 
 #pragma mark -
@@ -161,7 +174,6 @@ void WebInspectorClient::updateWindowTitle() const
 
     [preferences release];
 
-    // FIXME: The InspectorController should give us the URL to inspector.html
     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
     NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath:path]];
     [[_webView mainFrame] loadRequest:request];
@@ -171,7 +183,7 @@ void WebInspectorClient::updateWindowTitle() const
     return self;
 }
 
--(id)initWithInspectedWebView:(WebView *)webView
+- (id)initWithInspectedWebView:(WebView *)webView
 {
     if (![self init])
         return nil;
index a983e4c..757f659 100644 (file)
@@ -1,3 +1,14 @@
+2007-11-17  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        Bug 13470: i18n: The Web Inspector is not localizable
+        http://bugs.webkit.org/show_bug.cgi?id=13470
+
+        * WebCoreSupport/InspectorClientQt.cpp:
+        (WebCore::InspectorClientQt::localizedStringsURL): Empty stub.
+        * WebCoreSupport/InspectorClientQt.h: Added localizedStringsURL.
+
 2007-11-13  Geoffrey Garen  <ggaren@apple.com>
 
         Build fix: changed Shared to RefCounted.
index e7ad163..b89d8cb 100644 (file)
@@ -44,6 +44,12 @@ Page* InspectorClientQt::createPage()
     return 0;
 }
 
+String InspectorClientQt::localizedStringsURL()
+{
+    notImplemented();
+    return String();
+}
+
 void InspectorClientQt::showWindow()
 {
     notImplemented();
index e40422b..04074f8 100644 (file)
@@ -42,6 +42,8 @@ namespace WebCore {
 
         virtual Page* createPage();
 
+        virtual String localizedStringsURL();
+
         virtual void showWindow();
         virtual void closeWindow();
 
index f176022..b090883 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-17  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        Bug 13470: i18n: The Web Inspector is not localizable
+        http://bugs.webkit.org/show_bug.cgi?id=13470
+
+        * English.lproj/Localizable.strings: Updated.
+        * WebInspectorClient.cpp:
+        (WebInspectorClient::localizedStringsURL): Empty stub.
+        * WebInspectorClient.h: Added localizedStringsURL.
+
 2007-11-17  Alexey Proskuryakov  <ap@webkit.org>
 
         Windows build fix.
index a63e904..a61ee31 100644 (file)
Binary files a/WebKit/win/English.lproj/Localizable.strings and b/WebKit/win/English.lproj/Localizable.strings differ
index 1e9b5eb..2e8a0dd 100644 (file)
@@ -41,6 +41,7 @@
 #include <WebCore/FloatRect.h>
 #include <WebCore/FrameView.h>
 #include <WebCore/InspectorController.h>
+#include <WebCore/NotImplemented.h>
 #include <WebCore/Page.h>
 #include <WebCore/RenderObject.h>
 #pragma warning(pop)
@@ -132,6 +133,13 @@ Page* WebInspectorClient::createPage()
     return core(m_webView.get());
 }
 
+
+String WebInspectorClient::localizedStringsURL()
+{
+    notImplemented();
+    return String();
+}
+
 void WebInspectorClient::showWindow()
 {
     if (!m_hwnd)
index 599313a..0e81c71 100644 (file)
@@ -46,6 +46,9 @@ public:
     virtual void inspectorDestroyed();
 
     virtual WebCore::Page* createPage();
+
+    virtual WebCore::String localizedStringsURL();
+
     virtual void showWindow();
     virtual void closeWindow();
     virtual bool windowVisible();
index 079d5ae..d1988a9 100644 (file)
@@ -1,3 +1,14 @@
+2007-11-17  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        Bug 13470: i18n: The Web Inspector is not localizable
+        http://bugs.webkit.org/show_bug.cgi?id=13470
+
+        * WebKitSupport/InspectorClientWx.cpp:
+        (WebCore::InspectorClientWx::localizedStringsURL): Empty stub.
+        * WebKitSupport/InspectorClientWx.h: Added localizedStringsURL.
+
 2007-11-08  Kevin Ollivier  <kevino@theolliviers.com>
 
         Initial commit of wx implementation of WebKit. This includes
index 4756dbe..6fde953 100644 (file)
@@ -52,6 +52,12 @@ Page* InspectorClientWx::createPage()
     return 0;
 }
 
+String InspectorClientWx::localizedStringsURL()
+{
+    notImplemented();
+    return String();
+}
+
 void InspectorClientWx::showWindow()
 {
     notImplemented();
index 09f7938..5616278 100644 (file)
@@ -43,6 +43,8 @@ public:
 
     virtual Page* createPage();
 
+    virtual String localizedStringsURL();
+
     virtual void showWindow();
     virtual void closeWindow();