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

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

Issue 7086017: Fix the loading of ca@valencia.pak, which is available in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 9 years, 6 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 | « base/i18n/rtl.cc ('k') | ui/base/l10n/l10n_util_unittest.cc » ('j') | 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 3dbce9adf71c09495e0ba7dc075b34c47988b284..8011768cee614e3a795d55e59443b8c8156dddd6 100644
--- a/ui/base/l10n/l10n_util.cc
+++ b/ui/base/l10n/l10n_util.cc
@@ -259,6 +259,14 @@ bool CheckAndResolveLocale(const std::string& locale,
*resolved_locale = locale;
return true;
}
+
+ // If there's a variant, skip over it so we can try without the region
+ // code. For example, ca_ES@valencia should cause us to try ca@valencia
+ // before ca.
+ std::string::size_type variant_pos = locale.find('@');
+ if (variant_pos != std::string::npos)
+ return false;
+
// If the locale matches language but not country, use that instead.
// TODO(jungshik) : Nothing is done about languages that Chrome
// does not support but available on Windows. We fall
@@ -275,12 +283,12 @@ bool CheckAndResolveLocale(const std::string& locale,
tmp_locale.append("-419");
else if (LowerCaseEqualsASCII(lang, "zh")) {
// Map zh-HK and zh-MO to zh-TW. Otherwise, zh-FOO is mapped to zh-CN.
- if (LowerCaseEqualsASCII(region, "hk") ||
- LowerCaseEqualsASCII(region, "mo")) { // Macao
- tmp_locale.append("-TW");
- } else {
- tmp_locale.append("-CN");
- }
+ if (LowerCaseEqualsASCII(region, "hk") ||
+ LowerCaseEqualsASCII(region, "mo")) { // Macao
+ tmp_locale.append("-TW");
+ } else {
+ tmp_locale.append("-CN");
+ }
}
if (IsLocaleAvailable(tmp_locale, locale_path)) {
resolved_locale->swap(tmp_locale);
« no previous file with comments | « base/i18n/rtl.cc ('k') | ui/base/l10n/l10n_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698