summaryrefslogtreecommitdiffstats
path: root/base/i18n
diff options
context:
space:
mode:
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;
}