summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2014-06-06 17:09:04 -0500
committerBrant Knudson <bknudson@us.ibm.com>2014-06-11 15:45:34 -0500
commit324a99cd7969d9081dd74b4decdb4f61a6eae6e1 (patch)
tree4fcaf3a388403ca75602e50c0528732b55a17a37
parenta92f897ebc92efaad79eb1fddadaeb366aae2160 (diff)
downloadoslo-i18n-324a99cd7969d9081dd74b4decdb4f61a6eae6e1.tar.gz
Remove Babel version workaround code
Since Babel>=1.3 is required, code to work with earlier versions can be removed and the logic made clearer. Change-Id: I33f358912802fb1bd49ed377d974af9e213b9257
-rw-r--r--oslo/i18n/gettextutils.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/oslo/i18n/gettextutils.py b/oslo/i18n/gettextutils.py
index 38f78eb..03e72ab 100644
--- a/oslo/i18n/gettextutils.py
+++ b/oslo/i18n/gettextutils.py
@@ -73,25 +73,13 @@ def get_available_languages(domain):
# NOTE(mrodden): en_US should always be available (and first in case
# order matters) since our in-line message strings are en_US
language_list = ['en_US']
- # NOTE(luisg): Babel <1.0 used a function called list(), which was
- # renamed to locale_identifiers() in >=1.0, the requirements master list
- # requires >=0.9.6, uncapped, so defensively work with both. We can remove
- # this check when the master list updates to >=1.0, and update all projects
- list_identifiers = (getattr(localedata, 'list', None) or
- getattr(localedata, 'locale_identifiers'))
- locale_identifiers = list_identifiers()
-
+ locale_identifiers = localedata.locale_identifiers()
language_list.extend(language for language in locale_identifiers
if find(language, domain, localedir))
- # NOTE(luisg): Babel>=1.0,<1.3 has a bug where some OpenStack supported
- # locales (e.g. 'zh_CN', and 'zh_TW') aren't supported even though they
- # are perfectly legitimate locales:
- # https://github.com/mitsuhiko/babel/issues/37
- # In Babel 1.3 they fixed the bug and they support these locales, but
- # they are still not explicitly "listed" by locale_identifiers().
- # That is why we add the locales here explicitly if necessary so that
- # they are listed as supported.
+ # In Babel 1.3, locale_identifiers() doesn't list some OpenStack supported
+ # locales (e.g. 'zh_CN', and 'zh_TW') so we add the locales explicitly if
+ # necessary so that they are listed as supported.
aliases = {'zh': 'zh_CN',
'zh_Hant_HK': 'zh_HK',
'zh_Hant': 'zh_TW',