diff options
-rw-r--r-- | chrome/common/chrome_paths.cc | 9 | ||||
-rw-r--r-- | chrome/common/l10n_util.cc | 9 | ||||
-rw-r--r-- | chrome/common/l10n_util_unittest.cc | 7 | ||||
-rw-r--r-- | chrome/common/resource_bundle_mac.mm | 2 | ||||
-rwxr-xr-x | chrome/tools/mac_copy_grit_resources.sh | 4 |
5 files changed, 27 insertions, 4 deletions
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 40f22ba..2c80ff3 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -105,7 +105,7 @@ bool PathProvider(int key, FilePath* result) { case chrome::DIR_RESOURCES: if (!PathService::Get(chrome::DIR_APP, &cur)) return false; - cur = cur.Append(FILE_PATH_LITERAL("resources")); + cur = cur.Append(FILE_PATH_LITERAL("Resources")); create_dir = true; break; case chrome::DIR_INSPECTOR: @@ -123,7 +123,14 @@ bool PathProvider(int key, FilePath* result) { case chrome::DIR_LOCALES: if (!PathService::Get(chrome::DIR_APP, &cur)) return false; +#if defined(OS_MACOSX) + // On Mac, locale files are in Contents/Resources, a sibling of the + // App dir. + cur = cur.DirName(); + cur = cur.Append(FILE_PATH_LITERAL("Resources")); +#else cur = cur.Append(FILE_PATH_LITERAL("locales")); +#endif create_dir = true; break; case chrome::DIR_APP_DICTIONARIES: diff --git a/chrome/common/l10n_util.cc b/chrome/common/l10n_util.cc index 3926796..2c13dde 100644 --- a/chrome/common/l10n_util.cc +++ b/chrome/common/l10n_util.cc @@ -217,6 +217,14 @@ namespace l10n_util { static TextDirection g_text_direction = UNKNOWN_DIRECTION; std::wstring GetApplicationLocale(const std::wstring& pref_locale) { +#if defined(OS_MACOSX) + // On the mac, we don't want to test preferences or ICU for the language, + // we want to use whatever Cocoa is using when it loaded the main nib file. + // It handles all the mapping and fallbacks for us, we just need to ask + // Cocoa. + // TODO(pinkerton): break this out into a .mm and ask Cocoa. + return L"en"; +#else std::wstring locale_path; PathService::Get(chrome::DIR_LOCALES, &locale_path); std::wstring resolved_locale; @@ -250,6 +258,7 @@ std::wstring GetApplicationLocale(const std::wstring& pref_locale) { NOTREACHED(); return std::wstring(); +#endif } std::wstring GetLocalName(const std::wstring& locale_code_wstr, diff --git a/chrome/common/l10n_util_unittest.cc b/chrome/common/l10n_util_unittest.cc index bf94012..5464108 100644 --- a/chrome/common/l10n_util_unittest.cc +++ b/chrome/common/l10n_util_unittest.cc @@ -83,6 +83,12 @@ void SetICUDefaultLocale(const std::wstring& locale_string) { EXPECT_TRUE(U_SUCCESS(error_code)); } +#if defined(OS_WIN) || defined(OS_LINUX) +// We are disabling this test on MacOS because GetApplicationLocale() as an +// API isn't something that we'll easily be able to unit test in this manner. +// The meaning of that API, on the Mac, is "the locale used by Cocoa's main +// nib file", which clearly can't be stubbed by a test app that doesn't use +// Cocoa. TEST_F(L10nUtilTest, GetAppLocale) { // Use a temporary locale dir so we don't have to actually build the locale // dlls for this test. @@ -180,6 +186,7 @@ TEST_F(L10nUtilTest, GetAppLocale) { UErrorCode error_code = U_ZERO_ERROR; Locale::setDefault(locale, error_code); } +#endif TEST_F(L10nUtilTest, SortStringsUsingFunction) { std::vector<StringWrapper*> strings; diff --git a/chrome/common/resource_bundle_mac.mm b/chrome/common/resource_bundle_mac.mm index 7515ed7..e739855 100644 --- a/chrome/common/resource_bundle_mac.mm +++ b/chrome/common/resource_bundle_mac.mm @@ -47,7 +47,7 @@ base::DataPack *LoadResourceDataPack(NSString *name) { path = path.AppendASCII("Contents"); path = path.AppendASCII("Resources"); if ([name isEqual:@"locale"]) { - path = path.AppendASCII("English.lproj"); + path = path.AppendASCII("en.lproj"); } NSString *pakName = [name stringByAppendingPathExtension:pakExt]; path = path.Append([pakName fileSystemRepresentation]); diff --git a/chrome/tools/mac_copy_grit_resources.sh b/chrome/tools/mac_copy_grit_resources.sh index 936e221..4752380 100755 --- a/chrome/tools/mac_copy_grit_resources.sh +++ b/chrome/tools/mac_copy_grit_resources.sh @@ -31,7 +31,7 @@ fi if [ "${APP_RESOURCES_ROOT_DIR}/locale.pak" -ot \ "${REPACKED_DIR}/locale_en-US.pak" ] then - mkdir -p "${APP_RESOURCES_ROOT_DIR}/English.lproj" + mkdir -p "${APP_RESOURCES_ROOT_DIR}/en.lproj" cp -f "${REPACKED_DIR}/locale_en-US.pak" \ - "${APP_RESOURCES_ROOT_DIR}/English.lproj/locale.pak" + "${APP_RESOURCES_ROOT_DIR}/en.lproj/locale.pak" fi |