Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Unified Diff: ui/base/l10n/l10n_util.cc

Issue 10701179: Update handling of Android language codes (Closed) Base URL: http://git.chromium.org/chromium/src.git@bookmark-sync
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/l10n/l10n_util.cc
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc
index 534bf1e41438d4f16a4f214e9e94104c8c5cab34..ff8733c27cd7308b5bbe117fa43b76747d1be331 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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698