From 8fee1c35d91f2984c9a738008d5728e893ef91a5 Mon Sep 17 00:00:00 2001 From: "cjhopman@chromium.org" <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Mon, 6 Aug 2012 18:26:09 +0000 Subject: Update handling of Android language codes Chrome uses "id" as the Indonesian language code while Android uses the deprecated code "in". Similarly for Yiddish. This handles translating between the two. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10701179 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150115 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/base/l10n/l10n_util.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ui') diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index 534bf1e..ff8733c 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -269,8 +269,8 @@ bool CheckAndResolveLocale(const std::string& locale, // back to en-US in GetApplicationLocale so that it's a not critical, // but we can do better. std::string::size_type hyphen_pos = locale.find('-'); + std::string lang(locale, 0, hyphen_pos); if (hyphen_pos != std::string::npos && hyphen_pos > 0) { - std::string lang(locale, 0, hyphen_pos); std::string region(locale, hyphen_pos + 1); std::string tmp_locale(lang); // Map es-RR other than es-ES to es-419 (Chrome's Latin American @@ -306,8 +306,8 @@ bool CheckAndResolveLocale(const std::string& locale, } } - // Google updater uses no, iw and en for our nb, he, and en-US. - // We need to map them to our codes. + // Google updater uses no, iw and en for our nb, he, and en-US, and + // Android uses iw-*, in-*, and ji-*. We need to map them to our codes. struct { const char* source; const char* dest; @@ -316,10 +316,12 @@ bool CheckAndResolveLocale(const std::string& locale, {"tl", "fil"}, {"iw", "he"}, {"en", "en-US"}, + {"in", "id"}, + {"ji", "yi"}, }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(alias_map); ++i) { - if (LowerCaseEqualsASCII(locale, alias_map[i].source)) { + if (LowerCaseEqualsASCII(lang, alias_map[i].source)) { std::string tmp_locale(alias_map[i].dest); if (IsLocaleAvailable(tmp_locale)) { resolved_locale->swap(tmp_locale); -- cgit v1.1