summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild/mac/generate_localizer175
-rw-r--r--chrome/app/chromium_strings.grd11
-rw-r--r--chrome/app/generated_resources.grd140
-rw-r--r--chrome/app/google_chrome_strings.grd11
-rw-r--r--chrome/app/nibs/MainMenu.xib149
-rw-r--r--chrome/browser/DEPS1
-rw-r--r--chrome/browser/app_controller_mac.mm8
-rw-r--r--chrome/browser/cocoa/menu_localizer.h19
-rw-r--r--chrome/browser/cocoa/menu_localizer.mm33
-rw-r--r--chrome/browser/cocoa/ui_localizer.h31
-rw-r--r--chrome/browser/cocoa/ui_localizer.mm80
-rw-r--r--chrome/browser/cocoa/ui_localizer_unittest.mm46
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu_mac.mm7
-rw-r--r--chrome/chrome.gyp34
14 files changed, 582 insertions, 163 deletions
diff --git a/build/mac/generate_localizer b/build/mac/generate_localizer
new file mode 100755
index 0000000..4620b99
--- /dev/null
+++ b/build/mac/generate_localizer
@@ -0,0 +1,175 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Usage: generate_localizer [xib_path] [output_dot_h_path] [output_dot_mm_path]
+#
+# Extracts all the localizable strings that start with "^IDS" from the given
+# xib file, and then generates a localizer to process those strings.
+
+import os.path
+import plistlib
+import subprocess
+import sys
+
+generate_localizer = "me"
+
+localizer_template_h = \
+'''// ---------- WARNING ----------
+// THIS IS A GENERATED FILE, DO NOT EDIT IT DIRECTLY!
+//
+// Generated by %(generate_localizer)s.
+// Generated from %(xib_file)s.
+//
+
+#ifndef %(class_name)s_LOCALIZER_H_
+#define %(class_name)s_LOCALIZER_H_
+
+#import "third_party/GTM/AppKit/GTMUILocalizer.h"
+
+// A subclass of GTMUILocalizer that handles localizes based on resource
+// constants.
+
+@interface %(class_name)sLocalizer : GTMUILocalizer {
+}
+@end
+
+#endif // %(class_name)s_LOCALIZER_H_
+'''
+
+localizer_template_mm = \
+'''// ---------- WARNING ----------
+// THIS IS A GENERATED FILE, DO NOT EDIT IT DIRECTLY!
+//
+// Generated by '%(generate_localizer)s'.
+// Generated from '%(xib_file)s'.
+//
+
+#import "%(header_name)s"
+
+#import "chrome/browser/cocoa/ui_localizer.h"
+#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
+
+@implementation %(class_name)sLocalizer
+
+- (NSString *)localizedStringForString:(NSString *)string {
+
+ static const ui_localizer::ResourceMap kUIResources[] = {
+%(resource_map_list)s };
+ static const size_t kUIResourcesSize = arraysize(kUIResources);
+
+ return ui_localizer::LocalizedStringForKeyFromMapList(string,
+ kUIResources,
+ kUIResourcesSize);
+}
+
+@end
+'''
+
+def xib_localizable_strings(xib_path):
+ """Runs ibtool to extract the localizable strings data from the xib."""
+ ibtool_cmd = subprocess.Popen(['/usr/bin/ibtool', '--localizable-strings',
+ xib_path],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (cmd_out, cmd_err) = ibtool_cmd.communicate()
+ if ibtool_cmd.returncode:
+ sys.stderr.write('%s:0: error: ibtool on "%s" failed (%d):\n%s\n' %
+ (generate_localizer, xib_path, ibtool_cmd.returncode,
+ cmd_err))
+ return None
+ return cmd_out
+
+def extract_resource_constants(plist_localizable_strings_dict, xib_path):
+ """Extracts all the values that start with ^IDS from the localizable
+ strings plist entry."""
+ constants_list = []
+ for item_dict in plist_localizable_strings_dict.itervalues():
+ for item_value in item_dict.itervalues():
+ if item_value.startswith('^IDS'):
+ constants_list.append(item_value)
+ elif item_value.startswith('IDS'):
+ sys.stderr.write(
+ '%s:0: warning: %s found a string with questionable prefix, "%s"\n'
+ % (xib_path, generate_localizer, item_value));
+ return constants_list
+
+def generate_files_contents(class_name, constants_list, header_name, xib_path):
+ """Generates a localizer files contents from the list of constants."""
+ # Copy and sort the list, then build the strings we need from it.
+ constants_list = constants_list[:]
+ constants_list.sort()
+ constant_list_str = ''
+ for item in constants_list:
+ parts = item.split('$', 1)
+ label_id = parts[0]
+ if len(parts) == 2:
+ label_arg_id = parts[1]
+ else:
+ label_arg_id = '0'
+ constant_list_str += ' { "%s", %s, %s },\n' % \
+ ( item, label_id[1:], label_arg_id)
+ # Assemble the contents from the templates.
+ values_dict = {
+ 'class_name': class_name,
+ 'header_name': header_name,
+ 'resource_map_list': constant_list_str,
+ 'generate_localizer': generate_localizer,
+ 'xib_file': xib_path,
+ }
+ h_file = localizer_template_h % values_dict
+ mm_file = localizer_template_mm % values_dict
+ return (h_file, mm_file)
+
+
+def Main(argv=None):
+ global generate_localizer
+ generate_localizer = os.path.basename(argv[0])
+
+ # Args
+ if len(argv) != 4:
+ sys.stderr.write('%s:0: error: Expected xib and output file arguments\n' %
+ generate_localizer);
+ return 1
+ xib_path, output_h_path, output_mm_path = argv[1:]
+
+ # Run ibtool and convert to something Python can deal with
+ plist_string = xib_localizable_strings(xib_path)
+ if not plist_string:
+ return 2
+ plist = plistlib.readPlistFromString(plist_string)
+
+ # Extract the resource constant strings
+ localizable_strings = plist['com.apple.ibtool.document.localizable-strings']
+ constants_list = extract_resource_constants(localizable_strings, xib_path)
+ if not constants_list:
+ sys.stderr.write("%s:0: warning: %s didn't find any resource strings\n" %
+ xib_path, generate_localizer);
+
+ # Name the class based on the output file
+ class_name = os.path.splitext(os.path.basename(output_h_path))[0]
+ suffix = '_localizer'
+ if class_name.endswith(suffix):
+ class_name = class_name[:-len(suffix)];
+ class_name = class_name.replace('_', ' ').title().replace(' ', '');
+
+ # Generate our file contents
+ (h_file_content, mm_file_content) = \
+ generate_files_contents(class_name, constants_list,
+ os.path.basename(output_h_path),
+ xib_path)
+
+ # Write out the files
+ file_fd = open(output_h_path, 'w')
+ file_fd.write(h_file_content)
+ file_fd.close()
+ file_fd = open(output_mm_path, 'w')
+ file_fd.write(mm_file_content)
+ file_fd.close()
+
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(Main(sys.argv))
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index b3335cb..3d4059ef 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -343,17 +343,6 @@ be available for now. -->
<message name="IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT" desc="More compact text to show in the default browser query infobar.">
Chromium isn't your default browser.
</message>
- <if expr="os == 'darwin'">
- <message name="IDS_EXIT_MAC" desc="The menu item to quit the browser in the app menu.">
- Quit Chromium
- </message>
- <message name="IDS_HIDE_MAC" desc="The menu item to hide all browser windows in the app menu.">
- Hide Chromium
- </message>
- <message name="IDS_HELP_MAC" desc="The menu item to show help in the Help menu.">
- Chromium Help
- </message>
- </if>
</messages>
</release>
</grit>
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index cd60d42..84508d4 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4058,6 +4058,146 @@ each locale. -->
Created new window in existing browser session.
</message>
+ <!-- Mac Menubar Menus -->
+ <if expr="os == 'darwin'">
+ <!-- Menubar Menu Titles -->
+ <!-- TODO: these titles aren't in MainMenu.xib because of UI flash, see http://crbug.com/17380 for what needs to happen to get them into the xib -->
+ <message name="IDS_FILE_MENU_MAC" desc="The menu title of the file menu.">
+ File
+ </message>
+ <message name="IDS_EDIT_MENU_MAC" desc="The menu title of the edit menu.">
+ Edit
+ </message>
+ <message name="IDS_VIEW_MENU_MAC" desc="The menu title of the view menu.">
+ View
+ </message>
+ <message name="IDS_HISTORY_MENU_MAC" desc="The menu title of the history menu.">
+ History
+ </message>
+ <message name="IDS_BOOKMARKS_MENU_MAC" desc="The menu title of the bookmarks menu.">
+ Bookmarks
+ </message>
+ <message name="IDS_WINDOW_MENU_MAC" desc="The menu title of the window menu.">
+ Window
+ </message>
+ <message name="IDS_HELP_MENU_MAC" desc="The menu title of the help menu.">
+ Help
+ </message>
+ <!-- App menu -->
+ <message name="IDS_PREFERENCES_MAC" desc="The menu item to open the preferences window in the app menu.">
+ Preferences...
+ </message>
+ <message name="IDS_HIDE_APP_MAC" desc="The menu item to hide all browser windows in the app menu.">
+ Hide <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>
+ </message>
+ <message name="IDS_HIDE_OTHERS_MAC" desc="The menu item to hide other applications' windows in the app menu.">
+ Hide Others
+ </message>
+ <message name="IDS_SHOW_ALL_MAC" desc="The menu item to show all browser windows in the app menu.">
+ Show All
+ </message>
+ <message name="IDS_EXIT_MAC" desc="The menu item to quit the browser in the app menu.">
+ Quit <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>
+ </message>
+ <!-- File menu -->
+ <message name="IDS_REOPEN_CLOSED_TABS_MAC" desc="The menu item reopen recently closed tabs in the file menu.">
+ Reopen Closed Tabs
+ </message>
+ <message name="IDS_OPEN_FILE_MAC" desc="The menu item to open a file in the file menu.">
+ Open File...
+ </message>
+ <message name="IDS_OPEN_LOCATION_MAC" desc="The menu item to open a location in the file menu (puts cursor in the url bar).">
+ Open Locations...
+ </message>
+ <message name="IDS_OPEN_RECENT_MAC" desc="The menu item for the recent files menu in the file menu.">
+ Open Recent
+ </message>
+ <message name="IDS_CREATE_APPLICATION_MAC" desc="The menu item to create an application shortcut in the file menu.">
+ Create Application Shortcut...
+ </message>
+ <message name="IDS_CLOSE_WINDOW_MAC" desc="The menu item to close a window in the file menu.">
+ Close Window
+ </message>
+ <message name="IDS_CLOSE_TAB_MAC" desc="The menu item to close a browser tab in the file menu.">
+ Close Tab
+ </message>
+ <message name="IDS_EMAIL_PAGE_LOCATION_MAC" desc="The menu item to email the page location in the file menu.">
+ Email Page Location
+ </message>
+ <message name="IDS_PRINT_PAGE_SETUP_MAC" desc="The menu item to open the printer page setup window in the file menu.">
+ Page Setup...
+ </message>
+ <!-- Edit menu -->
+ <message name="IDS_EDIT_UNDO_MAC" desc="The menu item undo in the edit menu.">
+ Undo
+ </message>
+ <message name="IDS_EDIT_REDO_MAC" desc="The menu item redo in the edit menu.">
+ Redo
+ </message>
+ <message name="IDS_EDIT_COPY_URL_MAC" desc="The menu item copy url in the edit menu.">
+ Copy URL
+ </message>
+ <message name="IDS_EDIT_DELETE_MAC" desc="The menu item delete in the edit menu.">
+ Delete
+ </message>
+ <message name="IDS_EDIT_SELECT_ALL_MAC" desc="The menu item select all in the edit menu.">
+ Select All
+ </message>
+ <!-- View menu -->
+ <message name="IDS_STOP_MENU_MAC" desc="The menu item stop in the view menu.">
+ Stop
+ </message>
+ <message name="IDS_RELOAD_MENU_MAC" desc="The menu item reload in the view menu.">
+ Reload
+ </message>
+ <message name="IDS_TEXT_BIGGER_MAC" desc="The menu item to make text bigger in the view menu.">
+ Make Text Bigger
+ </message>
+ <message name="IDS_TEXT_DEFAULT_MAC" desc="The menu item to make text default in the view menu.">
+ Make Text Default
+ </message>
+ <message name="IDS_TEXT_SMALLER_MAC" desc="The menu item to make text smaller in the view menu.">
+ Make Text Smaller
+ </message>
+ <message name="IDS_TEXT_ENCODING_MAC" desc="The menu item for the text encoding submenu in the view menu.">
+ Text Encoding
+ </message>
+ <!-- History menu -->
+ <message name="IDS_HISTORY_HOME_MAC" desc="The menu item for home in the history menu.">
+ Home
+ </message>
+ <message name="IDS_HISTORY_BACK_MAC" desc="The menu item for back in the history menu.">
+ Back
+ </message>
+ <message name="IDS_HISTORY_FORWARD_MAC" desc="The menu item for forward in the history menu.">
+ Forward
+ </message>
+ <!-- Bookmarks menu -->
+ <message name="IDS_BOOKMARK_CURRENT_PAGE_MAC" desc="The menu item for booking the current page in the bookmark menu.">
+ Bookmark Current Page...
+ </message>
+ <!-- Window menu -->
+ <message name="IDS_MINIMIZE_WINDOW_MAC" desc="The menu item for minimize the window menu.">
+ Minimize
+ </message>
+ <message name="IDS_ZOOM_WINDOW_MAC" desc="The menu item for zoom the window menu.">
+ Zoom
+ </message>
+ <message name="IDS_NEXT_TAB_MAC" desc="The menu item for next tab the window menu.">
+ Next Tab
+ </message>
+ <message name="IDS_PREV_TAB_MAC" desc="The menu item for previous tab the window menu.">
+ Previous Tab
+ </message>
+ <message name="IDS_ALL_WINDOWS_FRONT_MAC" desc="The menu item for bring all to front the window menu.">
+ Bring All to Front
+ </message>
+ <!-- Help menu -->
+ <message name="IDS_HELP_MAC" desc="The menu item to show help in the Help menu.">
+ <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> Help
+ </message> <!-- os == 'darwin' -->
+ </if>
+
</messages>
</release>
</grit>
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index f54fea6..2715214 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -391,17 +391,6 @@ Chrome supports. -->
<message name="IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT" desc="More compact text to show in the default browser query infobar.">
Google Chrome isn't your default browser.
</message>
- <if expr="os == 'darwin'">
- <message name="IDS_EXIT_MAC" desc="The menu item to quit the browser in the app menu.">
- Quit Google Chrome
- </message>
- <message name="IDS_HIDE_MAC" desc="The menu item to hide all browser windows in the app menu.">
- Hide Google Chrome
- </message>
- <message name="IDS_HELP_MAC" desc="The menu item to show help in the Help menu.">
- Google Chrome Help
- </message>
- </if>
</messages>
</release>
</grit>
diff --git a/chrome/app/nibs/MainMenu.xib b/chrome/app/nibs/MainMenu.xib
index 024f52c..1c71785 100644
--- a/chrome/app/nibs/MainMenu.xib
+++ b/chrome/app/nibs/MainMenu.xib
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9F33</string>
+ <string key="IBDocument.SystemVersion">9J61</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
- <string key="IBDocument.AppKitVersion">949.34</string>
- <string key="IBDocument.HIToolboxVersion">352.00</string>
+ <string key="IBDocument.AppKitVersion">949.46</string>
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="24"/>
+ <integer value="634"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -61,7 +61,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="238522557">
<reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">^About Chromium</string>
+ <string key="NSTitle">^IDS_ABOUT$IDS_PRODUCT_NAME</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -79,7 +79,7 @@
</object>
<object class="NSMenuItem" id="609285721">
<reference key="NSMenu" ref="110575045"/>
- <string type="base64-UTF8" key="NSTitle">UHJlZmVyZW5jZXPigKY</string>
+ <string key="NSTitle">^IDS_PREFERENCES_MAC</string>
<string key="NSKeyEquiv">,</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -98,7 +98,7 @@
</object>
<object class="NSMenuItem" id="52470633">
<reference key="NSMenu" ref="110575045"/>
- <string type="base64-UTF8" key="NSTitle">Q2xlYXIgQnJvd3NpbmcgRGF0YeKApg</string>
+ <string key="NSTitle">^IDS_CLEAR_BROWSING_DATA</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -143,7 +143,7 @@
</object>
<object class="NSMenuItem" id="755159360">
<reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">^Hide Chromium</string>
+ <string key="NSTitle">^IDS_HIDE_APP_MAC$IDS_PRODUCT_NAME</string>
<string key="NSKeyEquiv">h</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -152,7 +152,7 @@
</object>
<object class="NSMenuItem" id="342932134">
<reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Hide Others</string>
+ <string key="NSTitle">^IDS_HIDE_OTHERS_MAC</string>
<string key="NSKeyEquiv">h</string>
<int key="NSKeyEquivModMask">1572864</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -161,7 +161,7 @@
</object>
<object class="NSMenuItem" id="908899353">
<reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Show All</string>
+ <string key="NSTitle">^IDS_SHOW_ALL_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -179,7 +179,7 @@
</object>
<object class="NSMenuItem" id="632727374">
<reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">^Quit Chromium</string>
+ <string key="NSTitle">^IDS_EXIT_MAC$IDS_PRODUCT_NAME</string>
<string key="NSKeyEquiv">q</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -204,7 +204,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="603924433">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">New Tab</string>
+ <string key="NSTitle">^IDS_NEW_TAB</string>
<string key="NSKeyEquiv">t</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -214,7 +214,7 @@
</object>
<object class="NSMenuItem" id="705341025">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">New Window</string>
+ <string key="NSTitle">^IDS_NEW_WINDOW</string>
<string key="NSKeyEquiv">n</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -224,7 +224,7 @@
</object>
<object class="NSMenuItem" id="1063389418">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">New Incognito Window</string>
+ <string key="NSTitle">^IDS_NEW_INCOGNITO_WINDOW</string>
<string key="NSKeyEquiv">N</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -234,7 +234,7 @@
</object>
<object class="NSMenuItem" id="18234385">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Reopen Closed Tabs</string>
+ <string key="NSTitle">^IDS_REOPEN_CLOSED_TABS_MAC</string>
<string key="NSKeyEquiv">T</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -244,7 +244,7 @@
</object>
<object class="NSMenuItem" id="722745758">
<reference key="NSMenu" ref="720053764"/>
- <string type="base64-UTF8" key="NSTitle">T3BlbiBGaWxl4oCmA</string>
+ <string key="NSTitle">^IDS_OPEN_FILE_MAC</string>
<string key="NSKeyEquiv">o</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -254,7 +254,7 @@
</object>
<object class="NSMenuItem" id="165127946">
<reference key="NSMenu" ref="720053764"/>
- <string type="base64-UTF8" key="NSTitle">T3BlbiBMb2NhdGlvbuKApg</string>
+ <string key="NSTitle">^IDS_OPEN_LOCATION_MAC</string>
<string key="NSKeyEquiv">l</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -264,14 +264,14 @@
</object>
<object class="NSMenuItem" id="1025936716">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Open Recent</string>
+ <string key="NSTitle">^IDS_OPEN_RECENT_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
<reference key="NSMixedImage" ref="549394948"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="1065607017">
- <string key="NSTitle">Open Recent</string>
+ <string key="NSTitle">^IDS_OPEN_RECENT_MAC</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="759406840">
@@ -298,7 +298,7 @@
</object>
<object class="NSMenuItem" id="704317490">
<reference key="NSMenu" ref="720053764"/>
- <string type="base64-UTF8" key="NSTitle">Q3JlYXRlIEFwcGxpY2F0aW9u4oCmA</string>
+ <string key="NSTitle">^IDS_CREATE_APPLICATION_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -316,7 +316,7 @@
</object>
<object class="NSMenuItem" id="776162233">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Close Window</string>
+ <string key="NSTitle">^IDS_CLOSE_WINDOW_MAC</string>
<string key="NSKeyEquiv">w</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -325,7 +325,7 @@
</object>
<object class="NSMenuItem" id="1059729334">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Close Tab</string>
+ <string key="NSTitle">^IDS_CLOSE_TAB_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -334,7 +334,7 @@
</object>
<object class="NSMenuItem" id="117038363">
<reference key="NSMenu" ref="720053764"/>
- <string type="base64-UTF8" key="NSTitle">U2F2ZSBQYWdl4oCmA</string>
+ <string key="NSTitle">^IDS_SAVE_PAGE</string>
<string key="NSKeyEquiv">s</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -354,7 +354,7 @@
</object>
<object class="NSMenuItem" id="120844338">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Email Page Location</string>
+ <string key="NSTitle">^IDS_EMAIL_PAGE_LOCATION_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -372,7 +372,7 @@
</object>
<object class="NSMenuItem" id="294629803">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Page Setup...</string>
+ <string key="NSTitle">^IDS_PRINT_PAGE_SETUP_MAC</string>
<string key="NSKeyEquiv">P</string>
<int key="NSKeyEquivModMask">1179648</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -382,7 +382,7 @@
</object>
<object class="NSMenuItem" id="49223823">
<reference key="NSMenu" ref="720053764"/>
- <string type="base64-UTF8" key="NSTitle">UHJpbnTigKY</string>
+ <string key="NSTitle">^IDS_EMAIL_PAGE_LOCATION_MAC</string>
<string key="NSKeyEquiv">p</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -406,7 +406,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="1058277027">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Undo</string>
+ <string key="NSTitle">^IDS_EDIT_UNDO_MAC</string>
<string key="NSKeyEquiv">z</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -415,7 +415,7 @@
</object>
<object class="NSMenuItem" id="790794224">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Redo</string>
+ <string key="NSTitle">^IDS_EDIT_REDO_MAC</string>
<string key="NSKeyEquiv">Z</string>
<int key="NSKeyEquivModMask">1179648</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -434,7 +434,7 @@
</object>
<object class="NSMenuItem" id="296257095">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Cut</string>
+ <string key="NSTitle">^IDS_CUT</string>
<string key="NSKeyEquiv">x</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -443,7 +443,7 @@
</object>
<object class="NSMenuItem" id="860595796">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Copy</string>
+ <string key="NSTitle">^IDS_COPY</string>
<string key="NSKeyEquiv">c</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -452,7 +452,7 @@
</object>
<object class="NSMenuItem" id="442256518">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Copy URL</string>
+ <string key="NSTitle">^IDS_EDIT_COPY_URL_MAC</string>
<string key="NSKeyEquiv">c</string>
<int key="NSKeyEquivModMask">1572864</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -461,7 +461,7 @@
</object>
<object class="NSMenuItem" id="29853731">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Paste</string>
+ <string key="NSTitle">^IDS_PASTE</string>
<string key="NSKeyEquiv">v</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -470,7 +470,7 @@
</object>
<object class="NSMenuItem" id="437104165">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Delete</string>
+ <string key="NSTitle">^IDS_EDIT_DELETE_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -478,7 +478,7 @@
</object>
<object class="NSMenuItem" id="583158037">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Select All</string>
+ <string key="NSTitle">^IDS_EDIT_SELECT_ALL_MAC</string>
<string key="NSKeyEquiv">a</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -699,7 +699,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="102151532">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Always Show Bookmarks Bar</string>
+ <string key="NSTitle">^IDS_BOOMARK_BAR_ALWAYS_SHOW</string>
<string key="NSKeyEquiv">b</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -719,7 +719,7 @@
</object>
<object class="NSMenuItem" id="249269220">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Stop</string>
+ <string key="NSTitle">^IDS_STOP_MENU_MAC</string>
<string key="NSKeyEquiv">.</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -729,7 +729,7 @@
</object>
<object class="NSMenuItem" id="152850290">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Reload</string>
+ <string key="NSTitle">^IDS_RELOAD_MENU_MAC</string>
<string key="NSKeyEquiv">r</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -749,7 +749,7 @@
</object>
<object class="NSMenuItem" id="530225222">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Full Screen</string>
+ <string key="NSTitle">^IDS_FULLSCREEN</string>
<string type="base64-UTF8" key="NSKeyEquiv">75yOA</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -759,7 +759,7 @@
</object>
<object class="NSMenuItem" id="407239884">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Make Text Bigger</string>
+ <string key="NSTitle">^IDS_TEXT_BIGGER_MAC</string>
<string key="NSKeyEquiv">=</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -769,7 +769,7 @@
</object>
<object class="NSMenuItem" id="577314768">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Make Text Default</string>
+ <string key="NSTitle">^IDS_TEXT_DEFAULT_MAC</string>
<string key="NSKeyEquiv">0</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -779,7 +779,7 @@
</object>
<object class="NSMenuItem" id="115970721">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Make Text Smaller</string>
+ <string key="NSTitle">^IDS_TEXT_SMALLER_MAC</string>
<string key="NSKeyEquiv">-</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -799,7 +799,7 @@
</object>
<object class="NSMenuItem" id="602502221">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Text Encoding</string>
+ <string key="NSTitle">^IDS_TEXT_ENCODING_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -807,7 +807,7 @@
<string key="NSAction">submenuAction:</string>
<int key="NSTag">35005</int>
<object class="NSMenu" key="NSSubmenu" id="466817936">
- <string key="NSTitle">Text Encoding</string>
+ <string key="NSTitle">^IDS_TEXT_ENCODING_MAC</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
@@ -815,19 +815,19 @@
</object>
<object class="NSMenuItem" id="749294230">
<reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Developer</string>
+ <string key="NSTitle">^IDS_DEVELOPER_MENU</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
<reference key="NSMixedImage" ref="549394948"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="99609113">
- <string key="NSTitle">Developer</string>
+ <string key="NSTitle">^IDS_DEVELOPER_MENU</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="656413452">
<reference key="NSMenu" ref="99609113"/>
- <string key="NSTitle">View Source</string>
+ <string key="NSTitle">^IDS_VIEW_SOURCE</string>
<string key="NSKeyEquiv">u</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -837,7 +837,7 @@
</object>
<object class="NSMenuItem" id="703868281">
<reference key="NSMenu" ref="99609113"/>
- <string key="NSTitle">JavaScript Console</string>
+ <string key="NSTitle">^IDS_DEV_TOOLS</string>
<string key="NSKeyEquiv">j</string>
<int key="NSKeyEquivModMask">1572864</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -848,7 +848,7 @@
<object class="NSMenuItem" id="693413486">
<reference key="NSMenu" ref="99609113"/>
<bool key="NSIsDisabled">YES</bool>
- <string key="NSTitle">Task Manager</string>
+ <string key="NSTitle">^IDS_TASK_MANAGER</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -874,7 +874,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="64100325">
<reference key="NSMenu" ref="436720301"/>
- <string key="NSTitle">Show History</string>
+ <string key="NSTitle">^IDS_SHOW_HISTORY</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -893,7 +893,7 @@
</object>
<object class="NSMenuItem" id="168518061">
<reference key="NSMenu" ref="436720301"/>
- <string key="NSTitle">Home</string>
+ <string key="NSTitle">^IDS_HISTORY_HOME_MAC</string>
<string key="NSKeyEquiv">H</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -903,7 +903,7 @@
</object>
<object class="NSMenuItem" id="1072249258">
<reference key="NSMenu" ref="436720301"/>
- <string key="NSTitle">Back</string>
+ <string key="NSTitle">^IDS_HISTORY_BACK_MAC</string>
<string key="NSKeyEquiv">[</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -913,7 +913,7 @@
</object>
<object class="NSMenuItem" id="912432543">
<reference key="NSMenu" ref="436720301"/>
- <string key="NSTitle">Forward</string>
+ <string key="NSTitle">^IDS_HISTORY_FORWARD_MAC</string>
<string key="NSKeyEquiv">]</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -957,7 +957,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="399860348">
<reference key="NSMenu" ref="891828782"/>
- <string type="base64-UTF8" key="NSTitle">Qm9va21hcmsgQ3VycmVudCBQYWdl4oCmA</string>
+ <string key="NSTitle">^IDS_BOOKMARK_CURRENT_PAGE_MAC</string>
<string key="NSKeyEquiv">d</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -993,7 +993,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="1011231497">
<reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Minimize</string>
+ <string key="NSTitle">^IDS_MINIMIZE_WINDOW_MAC</string>
<string key="NSKeyEquiv">m</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -1002,7 +1002,7 @@
</object>
<object class="NSMenuItem" id="575023229">
<reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Zoom</string>
+ <string key="NSTitle">^IDS_ZOOM_WINDOW_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -1020,7 +1020,7 @@
</object>
<object class="NSMenuItem" id="1051826322">
<reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Next Tab</string>
+ <string key="NSTitle">^IDS_NEXT_TAB_MAC</string>
<string type="base64-UTF8" key="NSKeyEquiv">75yDA</string>
<int key="NSKeyEquivModMask">1572864</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -1030,7 +1030,7 @@
</object>
<object class="NSMenuItem" id="567028653">
<reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Previous Tab</string>
+ <string key="NSTitle">^IDS_PREV_TAB_MAC</string>
<string type="base64-UTF8" key="NSKeyEquiv">75yCA</string>
<int key="NSKeyEquivModMask">1572864</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -1050,7 +1050,7 @@
</object>
<object class="NSMenuItem" id="238061183">
<reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Downloads</string>
+ <string key="NSTitle">^IDS_SHOW_DOWNLOADS</string>
<string key="NSKeyEquiv">J</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -1070,7 +1070,7 @@
</object>
<object class="NSMenuItem" id="625202149">
<reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Bring All to Front</string>
+ <string key="NSTitle">^IDS_ALL_WINDOWS_FRONT_MAC</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="353210768"/>
@@ -1104,7 +1104,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="238773614">
<reference key="NSMenu" ref="374024848"/>
- <string key="NSTitle">^Chromium Help</string>
+ <string key="NSTitle">^IDS_HELP_MAC$IDS_PRODUCT_NAME</string>
<string key="NSKeyEquiv">?</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -2732,7 +2732,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" id="9"/>
- <string>{{715, 938}, {190, 23}}</string>
+ <string>{{627, 1113}, {335, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{596, 852}, {216, 23}}</string>
@@ -2792,7 +2792,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{678, 873}, {243, 263}}</string>
+ <string>{{301, 873}, {287, 263}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{197, 734}, {243, 243}}</string>
@@ -2838,17 +2838,17 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{933, 973}, {213, 163}}</string>
+ <string>{{556, 973}, {326, 163}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{525, 802}, {197, 73}}</string>
- <string>{{530, 1136}, {535, 20}}</string>
+ <string>{{153, 1136}, {535, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{74, 862}</string>
<string>{{11, 977}, {478, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{722, 923}, {287, 213}}</string>
+ <string>{{345, 923}, {345, 213}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{475, 832}, {234, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2890,18 +2890,18 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{839, 1103}, {254, 33}}</string>
+ <string>{{462, 1103}, {347, 33}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{1023, 853}, {217, 63}}</string>
+ <string>{{690, 883}, {241, 63}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{772, 1013}, {188, 123}}</string>
+ <string>{{395, 1013}, {304, 123}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2943,7 +2943,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{636, 813}, {249, 323}}</string>
+ <string>{{259, 813}, {332, 323}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{323, 672}, {199, 203}}</string>
@@ -2975,7 +2975,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">636</int>
+ <int key="maxID">638</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3057,6 +3057,13 @@
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/status_bubble_mac.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
<string key="minorKey">browser/cocoa/tab_strip_model_observer_bridge.h</string>
</object>
</object>
@@ -3101,7 +3108,7 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.LastKnownRelativeProjectPath">../../../chrome.xcodeproj</string>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../../chrome.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index d5be2b8..a4b5411 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -10,6 +10,7 @@ include_rules = [
"+skia/include",
"+webkit/default_plugin",
"+webkit/glue", # Defines some types that are marshalled over IPC.
+ "+xib_localizers", # For generated mac localization helpers
# Other libraries.
"+chrome/third_party/hunspell",
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 5205114..5cdaa1c 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -18,7 +18,6 @@
#import "chrome/browser/cocoa/bookmark_menu_bridge.h"
#import "chrome/browser/cocoa/clear_browsing_data_controller.h"
#import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h"
-#import "chrome/browser/cocoa/menu_localizer.h"
#import "chrome/browser/cocoa/preferences_window_controller.h"
#import "chrome/browser/cocoa/tab_strip_controller.h"
#import "chrome/browser/cocoa/tab_window_controller.h"
@@ -28,6 +27,7 @@
#include "chrome/common/pref_service.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/temp_scaffolding_stubs.h"
+#import "xib_localizers/main_menu_localizer.h"
@interface AppController(PRIVATE)
- (void)initMenuState;
@@ -215,12 +215,14 @@
DCHECK(g_browser_process);
g_browser_process->AddRefModule();
+ // TODO: move this into the MainMenu.xib once we clean up the startup order
+ // dependencies so that works. http://crbug.com/17380
// Create the localizer for the main menu. We can't do this in the nib
// because it's too early. Do it before we create any bookmark menus as well,
// just in case one has a title that matches any of our strings (unlikely,
// but technically possible).
- scoped_nsobject<MenuLocalizer> localizer(
- [[MenuLocalizer alloc] initWithBundle:nil]);
+ scoped_nsobject<MainMenuLocalizer> localizer(
+ [[MainMenuLocalizer alloc] initWithBundle:nil]);
[localizer localizeObject:[NSApplication sharedApplication]
recursively:YES];
diff --git a/chrome/browser/cocoa/menu_localizer.h b/chrome/browser/cocoa/menu_localizer.h
deleted file mode 100644
index 862ba20..0000000
--- a/chrome/browser/cocoa/menu_localizer.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_COCOA_MENU_LOCALIZER_H_
-#define CHROME_BROWSER_COCOA_MENU_LOCALIZER_H_
-
-#import <Cocoa/Cocoa.h>
-
-#import "third_party/GTM/AppKit/GTMUILocalizer.h"
-
-// A subclass of GTMUILocalizer that handles localizing our main menus. It maps
-// from the ^-prefixed strings in the nib into the strings bundles.
-
-@interface MenuLocalizer : GTMUILocalizer {
-}
-@end
-
-#endif // CHROME_BROWSER_COCOA_MENU_LOCALIZER_H_
diff --git a/chrome/browser/cocoa/menu_localizer.mm b/chrome/browser/cocoa/menu_localizer.mm
deleted file mode 100644
index 7b09520..0000000
--- a/chrome/browser/cocoa/menu_localizer.mm
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/cocoa/menu_localizer.h"
-
-#include "app/l10n_util.h"
-#include "base/sys_string_conversions.h"
-#include "grit/chromium_strings.h"
-
-@implementation MenuLocalizer
-
-// Override to map into our string bundles instead of strings plists.
-// TODO(pinkerton): This should use a string lookup table to map the string to
-// a constant.
-- (NSString *)localizedStringForString:(NSString *)string {
- if ([string isEqualToString:@"^Quit Chromium"]) {
- std::wstring quitString = l10n_util::GetString(IDS_EXIT_MAC);
- return base::SysWideToNSString(quitString);
- } else if ([string isEqualToString:@"^About Chromium"]) {
- std::wstring quitString = l10n_util::GetString(IDS_ABOUT_CHROME_TITLE);
- return base::SysWideToNSString(quitString);
- } else if ([string isEqualToString:@"^Hide Chromium"]) {
- std::wstring quitString = l10n_util::GetString(IDS_HIDE_MAC);
- return base::SysWideToNSString(quitString);
- } else if ([string isEqualToString:@"^Chromium Help"]) {
- std::wstring quitString = l10n_util::GetString(IDS_HELP_MAC);
- return base::SysWideToNSString(quitString);
- }
- return [super localizedStringForString:string];
-}
-
-@end
diff --git a/chrome/browser/cocoa/ui_localizer.h b/chrome/browser/cocoa/ui_localizer.h
new file mode 100644
index 0000000..b4702ad
--- /dev/null
+++ b/chrome/browser/cocoa/ui_localizer.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_COCOA_UI_LOCALIZER_H_
+#define CHROME_BROWSER_COCOA_UI_LOCALIZER_H_
+
+#include "base/basictypes.h"
+#include "base/string16.h"
+
+@class NSString;
+
+namespace ui_localizer {
+
+// Remove the Windows-style accelerator marker and change "..." into an
+// ellipsis. Returns the result in an autoreleased NSString.
+NSString* FixUpWindowsStyleLabel(const string16& label);
+
+struct ResourceMap {
+ const char* const name;
+ unsigned int label_id;
+ unsigned int label_arg_id;
+};
+
+NSString* LocalizedStringForKeyFromMapList(NSString* key,
+ const ResourceMap* map_list,
+ size_t map_list_len);
+
+} // namespace ui_localizer
+
+#endif // CHROME_BROWSER_COCOA_UI_LOCALIZER_H_
diff --git a/chrome/browser/cocoa/ui_localizer.mm b/chrome/browser/cocoa/ui_localizer.mm
new file mode 100644
index 0000000..e9be6dc
--- /dev/null
+++ b/chrome/browser/cocoa/ui_localizer.mm
@@ -0,0 +1,80 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "chrome/browser/cocoa/ui_localizer.h"
+
+#import <Foundation/Foundation.h>
+
+#include "app/l10n_util.h"
+#include "base/sys_string_conversions.h"
+#include "base/logging.h"
+
+namespace ui_localizer {
+
+NSString* FixUpWindowsStyleLabel(const string16& label) {
+ const char16 kEllipsisUTF16 = 0x2026;
+ string16 ret;
+ size_t label_len = label.length();
+ ret.reserve(label_len);
+ for (size_t i = 0; i < label_len; ++i) {
+ char16 c = label[i];
+ if (c == '&') {
+ if (i + 1 < label_len && label[i + 1] == '&') {
+ ret.push_back(c);
+ ++i;
+ }
+ } else if (c == '.' && i + 2 < label_len && label[i + 1] == '.'
+ && label[i + 2] == '.') {
+ ret.push_back(kEllipsisUTF16);
+ i += 2;
+ } else {
+ ret.push_back(c);
+ }
+ }
+
+ return base::SysUTF16ToNSString(ret);
+}
+
+NSString* LocalizedStringForKeyFromMapList(NSString* key,
+ const ResourceMap* map_list,
+ size_t map_list_len) {
+ DCHECK(key != nil);
+ DCHECK(map_list != NULL);
+
+ // Look up the string for the resource id to fetch.
+ const char* utf8_key = [key UTF8String];
+ if (utf8_key) {
+ // If we end up with enough string constants in here, look at using bsearch
+ // to speed up the searching.
+ for (size_t i = 0; i < map_list_len; ++i) {
+ int strcmp_result = strcmp(utf8_key, map_list[i].name);
+ if (strcmp_result == 0) {
+ // Do we need to build the string, or just fetch it?
+ if (map_list[i].label_arg_id != 0) {
+ const string16 label_arg(
+ l10n_util::GetStringUTF16(map_list[i].label_arg_id));
+ return FixUpWindowsStyleLabel(
+ l10n_util::GetStringFUTF16(map_list[i].label_id, label_arg));
+ }
+
+ return FixUpWindowsStyleLabel(
+ l10n_util::GetStringUTF16(map_list[i].label_id));
+ }
+
+ // If we've passed where the string would be, give up.
+ if (strcmp_result < 0)
+ break;
+ }
+ }
+
+ // Sanity check, there shouldn't be any strings with this id that aren't
+ // in our map.
+ DLOG_IF(WARNING, [key hasPrefix:@"^ID"]) << "Key '" << utf8_key
+ << "' wasn't in the resource map?";
+
+ // If we didn't find anything, this string doesn't need localizing.
+ return nil;
+}
+
+} // namespace ui_localizer
diff --git a/chrome/browser/cocoa/ui_localizer_unittest.mm b/chrome/browser/cocoa/ui_localizer_unittest.mm
new file mode 100644
index 0000000..a6756a9
--- /dev/null
+++ b/chrome/browser/cocoa/ui_localizer_unittest.mm
@@ -0,0 +1,46 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <Foundation/Foundation.h>
+
+#include "base/sys_string_conversions.h"
+#include "chrome/browser/cocoa/ui_localizer.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+typedef PlatformTest UILocalizerTest;
+
+TEST_F(UILocalizerTest, FixUpWindowsStyleLabel) {
+ struct TestData {
+ NSString* input;
+ NSString* output;
+ };
+
+ TestData data[] = {
+ { @"", @"" },
+ { @"nothing", @"nothing" },
+ { @"foo &bar", @"foo bar" },
+ { @"foo &&bar", @"foo &bar" },
+ { @"foo &&&bar", @"foo &bar" },
+ { @"&foo &&bar", @"foo &bar" },
+ { @"&foo &bar", @"foo bar" },
+ { @"foo bar.", @"foo bar." },
+ { @"foo bar..", @"foo bar.." },
+ { @"foo bar...", @"foo bar\u2026" },
+ { @"foo.bar", @"foo.bar" },
+ { @"foo..bar", @"foo..bar" },
+ { @"foo...bar", @"foo\u2026bar" },
+ { @"foo...bar...", @"foo\u2026bar\u2026" },
+ };
+ for (size_t idx = 0; idx < ARRAYSIZE_UNSAFE(data); ++idx) {
+ string16 input16(base::SysNSStringToUTF16(data[idx].input));
+
+ NSString* result = ui_localizer::FixUpWindowsStyleLabel(input16);
+ EXPECT_TRUE(result != nil) << "Fixup Failed, idx = " << idx;
+
+ EXPECT_TRUE([data[idx].output isEqualTo:result])
+ << "For idx " << idx << ", expected '" << [data[idx].output UTF8String]
+ << "', got '" << [result UTF8String] << "'";
+ }
+}
diff --git a/chrome/browser/tab_contents/render_view_context_menu_mac.mm b/chrome/browser/tab_contents/render_view_context_menu_mac.mm
index bdb3dd7..0004750 100644
--- a/chrome/browser/tab_contents/render_view_context_menu_mac.mm
+++ b/chrome/browser/tab_contents/render_view_context_menu_mac.mm
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "base/compiler_specific.h"
#include "base/sys_string_conversions.h"
+#import "chrome/browser/cocoa/ui_localizer.h"
#include "chrome/browser/profile.h"
#include "grit/generated_resources.h"
#include "base/scoped_nsobject.h"
@@ -70,12 +71,8 @@ void RenderViewContextMenuMac::DoInit() {
// and middle-truncate?
NSString* RenderViewContextMenuMac::PrepareLabelForDisplay(
const string16& label) {
- // Strip out any "&"'s that are windows accelerators and we don't use.
- NSMutableString* title =
- [NSMutableString stringWithString:base::SysUTF16ToNSString(label)];
+ NSString* title = ui_localizer::FixUpWindowsStyleLabel(label);
DCHECK(title);
- NSRange range = NSMakeRange(0, [title length]);
- [title replaceOccurrencesOfString:@"&" withString:@"" options:0 range:range];
return title ? title : @"";
}
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 7d227aa..0381a2f 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -818,8 +818,6 @@
'browser/cocoa/infobar_text_field.mm',
'browser/cocoa/location_bar_view_mac.h',
'browser/cocoa/location_bar_view_mac.mm',
- 'browser/cocoa/menu_localizer.h',
- 'browser/cocoa/menu_localizer.mm',
'browser/cocoa/nsimage_cache.h',
'browser/cocoa/nsimage_cache.mm',
'browser/cocoa/page_info_window_controller.h',
@@ -863,6 +861,8 @@
'browser/cocoa/toolbar_controller.mm',
'browser/cocoa/toolbar_view.h',
'browser/cocoa/toolbar_view.mm',
+ 'browser/cocoa/ui_localizer.h',
+ 'browser/cocoa/ui_localizer.mm',
'browser/cocoa/web_drop_target.h',
'browser/cocoa/web_drop_target.mm',
'browser/command_updater.cc',
@@ -1954,6 +1954,24 @@
'$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
],
},
+ 'actions': [
+ # This block of actions are used to extract the localization data
+ # from xib files and generate a localizer out of it.
+ {
+ 'action_name': 'process_mainmenu_xib',
+ 'process_outputs_as_sources': 1,
+ 'inputs': [
+ '<(DEPTH)/build/mac/generate_localizer',
+ 'app/nibs/MainMenu.xib'
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/xib_localizers/main_menu_localizer.h',
+ '<(INTERMEDIATE_DIR)/xib_localizers/main_menu_localizer.mm',
+ ],
+ 'action': ['<@(_inputs)', '<@(_outputs)'],
+ },
+ # TODO(tvl): add other xibs
+ ],
}],
['OS=="win"', {
'defines': [
@@ -3103,12 +3121,7 @@
'conditions': [
['OS=="mac"', {
'outputs': [
- # TODO(port): We can't simply emit the strings file without
- # the nibs too, or the app fails to launch in this language.
- # Currently, this is only for ui_tests, which won't work on
- # the Mac anyway, so temporarily disable until we have the
- # full strategy figured out. This goes for he and zh below.
- # '<(INTERMEDIATE_DIR)/repack/da.lproj/locale.pak',
+ '<(INTERMEDIATE_DIR)/repack/da.lproj/locale.pak',
],
}, { # else: OS!="mac"
'outputs': [
@@ -3187,7 +3200,7 @@
'conditions': [
['OS=="mac"', {
'outputs': [
- # '<(INTERMEDIATE_DIR)/repack/he.lproj/locale.pak',
+ '<(INTERMEDIATE_DIR)/repack/he.lproj/locale.pak',
],
}, { # else: OS!="mac"
'outputs': [
@@ -3226,7 +3239,7 @@
'conditions': [
['OS=="mac"', {
'outputs': [
- # '<(INTERMEDIATE_DIR)/repack/zh.lproj/locale.pak',
+ '<(INTERMEDIATE_DIR)/repack/zh.lproj/locale.pak',
],
}, { # else: OS!="mac"
'outputs': [
@@ -3707,6 +3720,7 @@
'browser/cocoa/toolbar_button_cell_unittest.mm',
'browser/cocoa/toolbar_controller_unittest.mm',
'browser/cocoa/toolbar_view_unittest.mm',
+ 'browser/cocoa/ui_localizer_unittest.mm',
'browser/cocoa/web_drop_target_unittest.mm',
'browser/command_updater_unittest.cc',
'browser/debugger/devtools_manager_unittest.cc',