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

Unified Diff: ui/base/l10n/l10n_util.cc

Issue 15311006: Added and replaced some UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (Rebasing) Created 7 years, 7 months 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 | « ui/base/l10n/l10n_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/l10n/l10n_util.cc
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc
index 704696934cc68f8f1e9c6b0a1e9d5b8f49b864e2..690f2540062826fb4b973ea5bc4e7fc8c9570e50 100644
--- a/ui/base/l10n/l10n_util.cc
+++ b/ui/base/l10n/l10n_util.cc
@@ -208,19 +208,6 @@ bool IsDuplicateName(const std::string& locale_name) {
return false;
}
-bool IsLocaleNameTranslated(const char* locale,
- const std::string& display_locale) {
- string16 display_name =
- l10n_util::GetDisplayNameForLocale(locale, display_locale, false);
- // Because ICU sets the error code to U_USING_DEFAULT_WARNING whether or not
- // uloc_getDisplayName returns the actual translation or the default
- // value (locale code), we have to rely on this hack to tell whether
- // the translation is available or not. If ICU doesn't have a translated
- // name for this locale, GetDisplayNameForLocale will just return the
- // locale code.
- return !IsStringASCII(display_name) || UTF16ToASCII(display_name) != locale;
-}
-
// We added 30+ minimally populated locales with only a few entries
// (exemplar character set, script, writing direction and its own
// lanaguage name). These locales have to be distinguished from the
@@ -230,7 +217,7 @@ bool IsLocalePartiallyPopulated(const std::string& locale_name) {
// is not available. A more robust/elegant way to check is to add a special
// field (say, 'isPartial' to our version of ICU locale files) and
// check its value, but this hack seems to work well.
- return !IsLocaleNameTranslated("en", locale_name);
+ return !l10n_util::IsLocaleNameTranslated("en", locale_name);
}
#if !defined(OS_MACOSX)
@@ -405,6 +392,19 @@ base::LazyInstance<std::vector<std::string>, AvailableLocalesTraits >
namespace l10n_util {
+bool IsLocaleNameTranslated(const std::string& locale,
+ const std::string& display_locale) {
+ string16 display_name =
+ l10n_util::GetDisplayNameForLocale(locale, display_locale, false);
+ // Because ICU sets the error code to U_USING_DEFAULT_WARNING whether or not
+ // uloc_getDisplayName returns the actual translation or the default
+ // value (locale code), we have to rely on this hack to tell whether
+ // the translation is available or not. If ICU doesn't have a translated
+ // name for this locale, GetDisplayNameForLocale will just return the
+ // locale code.
+ return !IsStringASCII(display_name) || UTF16ToASCII(display_name) != locale;
+}
+
std::string GetApplicationLocale(const std::string& pref_locale) {
#if defined(OS_MACOSX)
« no previous file with comments | « ui/base/l10n/l10n_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698