From f733b901af079dfc50587e8cee30c6ea1fc803ff Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Mon, 6 Jun 2011 21:41:52 +0000 Subject: 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 --- base/i18n/rtl.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'base/i18n') 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; } -- cgit v1.1