summaryrefslogtreecommitdiffstats
path: root/base/i18n
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-06 21:41:52 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-06 21:41:52 +0000
commitf733b901af079dfc50587e8cee30c6ea1fc803ff (patch)
treee4bf093fe8d5ed8f2a7bb9f54b30203b3f52160b /base/i18n
parent20c36dc091d7435aed5b3019e07adde399426899 (diff)
downloadchromium_src-f733b901af079dfc50587e8cee30c6ea1fc803ff.zip
chromium_src-f733b901af079dfc50587e8cee30c6ea1fc803ff.tar.gz
chromium_src-f733b901af079dfc50587e8cee30c6ea1fc803ff.tar.bz2
Fix the loading of ca@valencia.pak, which is available in
Ubuntu's chromium-browser package. We weren't handling language variant at all. BUG=83397 TEST=Covered by new unittests. Review URL: http://codereview.chromium.org/7086017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/i18n')
-rw-r--r--base/i18n/rtl.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc
index 2712a44..9684b1d 100644
--- a/base/i18n/rtl.cc
+++ b/base/i18n/rtl.cc
@@ -20,10 +20,12 @@
namespace {
-// Extract language and country, ignore keywords, concatenate using dash.
+// Extract language, country and variant, but ignore keywords. For example,
+// en-US, ca@valencia, ca-ES@valencia.
std::string GetLocaleString(const icu::Locale& locale) {
const char* language = locale.getLanguage();
const char* country = locale.getCountry();
+ const char* variant = locale.getVariant();
std::string result =
(language != NULL && *language != '\0') ? language : "und";
@@ -33,6 +35,12 @@ std::string GetLocaleString(const icu::Locale& locale) {
result += country;
}
+ if (variant != NULL && *variant != '\0') {
+ std::string variant_str(variant);
+ StringToLowerASCII(&variant_str);
+ result += '@' + variant_str;
+ }
+
return result;
}