summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authortfarina <tfarina@chromium.org>2015-01-15 16:37:08 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-16 00:38:10 +0000
commit70dff4fc82ac26c9beecc54644ab7ee055596862 (patch)
treee9eb9e7612c57f2ee1572feb15be3d1685760baa /ui
parentb898fcf77075ff4671f9f454393154eac1c8d1ce (diff)
downloadchromium_src-70dff4fc82ac26c9beecc54644ab7ee055596862.zip
chromium_src-70dff4fc82ac26c9beecc54644ab7ee055596862.tar.gz
chromium_src-70dff4fc82ac26c9beecc54644ab7ee055596862.tar.bz2
Move l10n_util's GetCanonicalLocal() function into base/i18n module.
This removes the base version that takes const char*, and replace it by the one that takes const std::string&. Consolidating this code in one place and having a single function, instead of two with the same name in two different places. This is a redo of a patch that started in https://codereview.chromium.org/269943004/ and of another try that was made in https://codereview.chromium.org/834183005/. BUG=None TEST=base_unittests, ui_base_unittests and chrome. R=sky@chromium.org,thakis@chromium.org Review URL: https://codereview.chromium.org/846373002 Cr-Commit-Position: refs/heads/master@{#311781}
Diffstat (limited to 'ui')
-rw-r--r--ui/base/l10n/l10n_util.cc9
-rw-r--r--ui/base/l10n/l10n_util.h4
2 files changed, 3 insertions, 10 deletions
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc
index 7515f3f..eb49b14 100644
--- a/ui/base/l10n/l10n_util.cc
+++ b/ui/base/l10n/l10n_util.cc
@@ -310,10 +310,6 @@ base::LazyInstance<std::vector<std::string>, AvailableLocalesTraits>
namespace l10n_util {
-std::string GetCanonicalLocale(const std::string& locale) {
- return base::i18n::GetCanonicalLocale(locale.c_str());
-}
-
std::string GetLanguage(const std::string& locale) {
const std::string::size_type hyphen_pos = locale.find('-');
return std::string(locale, 0, hyphen_pos);
@@ -434,14 +430,15 @@ std::string GetApplicationLocaleInternal(const std::string& pref_locale) {
// First, try the preference value.
if (!pref_locale.empty())
- candidates.push_back(GetCanonicalLocale(pref_locale));
+ candidates.push_back(base::i18n::GetCanonicalLocale(pref_locale));
// 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);
+ std::back_inserter(candidates),
+ &base::i18n::GetCanonicalLocale);
} else {
// If no override was set, defer to ICU
candidates.push_back(base::i18n::GetConfiguredLocale());
diff --git a/ui/base/l10n/l10n_util.h b/ui/base/l10n/l10n_util.h
index e2cb27d..c957c3e 100644
--- a/ui/base/l10n/l10n_util.h
+++ b/ui/base/l10n/l10n_util.h
@@ -20,10 +20,6 @@
namespace l10n_util {
-// The same as base::i18n::GetCanonicalLocale(const char*), but takes
-// std::string as an argument.
-UI_BASE_EXPORT std::string GetCanonicalLocale(const std::string& locale);
-
// Takes normalized locale as |locale|. Returns language part (before '-').
UI_BASE_EXPORT std::string GetLanguage(const std::string& locale);