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

Unified Diff: app/l10n_util.h

Issue 5643002: Add utility function to determine if a locale is valid syntax; this will... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/l10n_util.h
===================================================================
--- app/l10n_util.h (revision 68996)
+++ app/l10n_util.h (working copy)
@@ -56,6 +56,25 @@
const std::string& display_locale,
bool is_for_ui);
+// Converts all - into _, to be consistent with ICU and file system names.
+std::string NormalizeLocale(const std::string& locale);
+
+// Produce a vector of parent locales for given locale.
+// It includes the current locale in the result.
+// sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr.
+void GetParentLocales(const std::string& current_locale,
+ std::vector<std::string>* parent_locales);
+
+// Checks if a string is plausibly a syntactically-valid locale string,
+// for cases where we want the valid input to be a locale string such as
+// 'en', 'pt-BR', 'fil', 'es-419', 'zh-Hans-CN', 'i-klingon' or
+// 'de_DE@collation=phonebook', but we don't want to limit it to
+// locales that Chrome actually knows about, so 'xx-YY' should be
+// accepted, but 'z', 'German', 'en-$1', or 'abcd-1234' should not.
+// Case-insensitive. Based on BCP 47, see:
+// http://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers
+bool IsValidLocaleSyntax(const std::string& locale);
+
//
// Mac Note: See l10n_util_mac.h for some NSString versions and other support.
//
« no previous file with comments | « no previous file | app/l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698