Commit 8fee1c35 authored by cjhopman@chromium.org's avatar cjhopman@chromium.org

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
parent 4f403546
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment