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

Unified Diff: app/l10n_util.cc

Issue 4139010: The UI language rather than the locale is now used to pick Chrome's language ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | app/l10n_util_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/l10n_util.cc
===================================================================
--- app/l10n_util.cc (revision 66182)
+++ app/l10n_util.cc (working copy)
@@ -8,7 +8,9 @@
#include <glib/gutils.h>
#endif
+#include <algorithm>
#include <cstdlib>
+#include <iterator>
#include "app/app_paths.h"
#include "app/l10n_util_collator.h"
@@ -30,6 +32,8 @@
#if defined(OS_MACOSX)
#include "app/l10n_util_mac.h"
+#elif defined(OS_WIN)
+#include "app/l10n_util_win.h"
#endif
namespace {
@@ -325,6 +329,10 @@
#endif
}
+std::string GetCanonicalLocale(const std::string& locale) {
+ return base::i18n::GetCanonicalLocale(locale.c_str());
+}
+
} // namespace
namespace l10n_util {
@@ -369,8 +377,16 @@
if (!pref_locale.empty())
candidates.push_back(pref_locale);
- // Next, try the system locale.
- candidates.push_back(base::i18n::GetConfiguredLocale());
+ // Next, try the overridden locale.
+ const std::vector<std::string>& languages = l10n_util::GetLocaleOverrides();
+ if (!languages.empty()) {
+ candidates.reserve(candidates.size() + languages.size());
+ std::transform(languages.begin(), languages.end(),
+ std::back_inserter(candidates), &GetCanonicalLocale);
+ } else {
+ // If no override was set, defer to ICU
+ candidates.push_back(base::i18n::GetConfiguredLocale());
+ }
#elif defined(OS_CHROMEOS)
« no previous file with comments | « no previous file | app/l10n_util_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698