diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 16:19:21 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 16:19:21 +0000 |
commit | 4db67943718c58094fc7e1a9e6ab8182d74badd6 (patch) | |
tree | ef8112377604af2c5b7cb3f3252b101b555704b9 /app/l10n_util.h | |
parent | 9d0bc41806fd2534b87b61cc09fb80f9b03ca99f (diff) | |
download | chromium_src-4db67943718c58094fc7e1a9e6ab8182d74badd6.zip chromium_src-4db67943718c58094fc7e1a9e6ab8182d74badd6.tar.gz chromium_src-4db67943718c58094fc7e1a9e6ab8182d74badd6.tar.bz2 |
Add utility function to determine if a locale is valid syntax; this will
be used by the TTS extension API. Moved some locale utility functions from
extension_l10n_util to l10n_util.
BUG=none
TEST=Adds new unit test
Review URL: http://codereview.chromium.org/5643002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69004 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/l10n_util.h')
-rw-r--r-- | app/l10n_util.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/l10n_util.h b/app/l10n_util.h index a1519b5..a71c21c 100644 --- a/app/l10n_util.h +++ b/app/l10n_util.h @@ -56,6 +56,25 @@ string16 GetDisplayNameForLocale(const std::string& locale, 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. // |