Update translation setup
Follow new infra setup for translations, see spec http://specs.openstack.org/openstack-infra/infra-specs/specs/translation_setup.html for full details. This basically renames oslo.i18n/locale/oslo.i18n.pot to oslo_i18n/locale/oslo_i18n.pot. For this we need to update setup.cfg. Update also domain name in _i18n.py. Update unit test to adapt to domain name change. Change-Id: Ie016591a38dc0a83aadde501f882ee7849fa0c4f
This commit is contained in:
parent
5af6d87eba
commit
cbb1204498
@ -19,7 +19,7 @@
|
||||
from oslo_i18n import _factory
|
||||
|
||||
# Create the global translation functions.
|
||||
_translators = _factory.TranslatorFactory('oslo.i18n')
|
||||
_translators = _factory.TranslatorFactory('oslo_i18n')
|
||||
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _translators.primary
|
||||
|
@ -90,12 +90,12 @@ class PrefixLazyTranslationTest(test_base.BaseTestCase):
|
||||
self.assertTrue(_lazy.USE_LAZY)
|
||||
default_lang = fixture.PrefixLazyTranslation._DEFAULT_LANG
|
||||
raw_id1 = 'fake msg1'
|
||||
expected_msg = 'oslo.i18n/' + default_lang + ': ' + raw_id1
|
||||
expected_msg = 'oslo_i18n/' + default_lang + ': ' + raw_id1
|
||||
msg1 = _(raw_id1) # noqa
|
||||
self.assertEqual([default_lang],
|
||||
_gettextutils.get_available_languages('oslo.i18n'))
|
||||
_gettextutils.get_available_languages('oslo_i18n'))
|
||||
self.assertEqual([default_lang],
|
||||
oslo_i18n.get_available_languages('oslo.i18n'))
|
||||
oslo_i18n.get_available_languages('oslo_i18n'))
|
||||
self.assertEqual(expected_msg, _translate.translate(msg1))
|
||||
|
||||
def test_extra_lang(self):
|
||||
@ -103,15 +103,15 @@ class PrefixLazyTranslationTest(test_base.BaseTestCase):
|
||||
languages.append(_FAKE_LANG)
|
||||
self.useFixture(fixture.PrefixLazyTranslation(languages=languages))
|
||||
raw_id1 = 'fake msg1'
|
||||
expected_msg_en_US = ('oslo.i18n/' +
|
||||
expected_msg_en_US = ('oslo_i18n/' +
|
||||
fixture.PrefixLazyTranslation._DEFAULT_LANG +
|
||||
': ' + raw_id1)
|
||||
expected_msg_en_ZZ = 'oslo.i18n/' + _FAKE_LANG + ': ' + raw_id1
|
||||
expected_msg_en_ZZ = 'oslo_i18n/' + _FAKE_LANG + ': ' + raw_id1
|
||||
msg1 = _(raw_id1) # noqa
|
||||
self.assertEqual(languages,
|
||||
_gettextutils.get_available_languages('oslo.i18n'))
|
||||
_gettextutils.get_available_languages('oslo_i18n'))
|
||||
self.assertEqual(languages,
|
||||
oslo_i18n.get_available_languages('oslo.i18n'))
|
||||
oslo_i18n.get_available_languages('oslo_i18n'))
|
||||
self.assertEqual(expected_msg_en_US, _translate.translate(msg1))
|
||||
self.assertEqual(expected_msg_en_ZZ,
|
||||
_translate.translate(msg1,
|
||||
|
12
setup.cfg
12
setup.cfg
@ -31,18 +31,18 @@ all_files = 1
|
||||
upload-dir = doc/build/html
|
||||
|
||||
[compile_catalog]
|
||||
directory = oslo.i18n/locale
|
||||
domain = oslo.i18n
|
||||
directory = oslo_i18n/locale
|
||||
domain = oslo_i18n
|
||||
|
||||
[update_catalog]
|
||||
domain = oslo.i18n
|
||||
output_dir = oslo.i18n/locale
|
||||
input_file = oslo.i18n/locale/oslo.i18n.pot
|
||||
domain = oslo_i18n
|
||||
output_dir = oslo_i18n/locale
|
||||
input_file = oslo_i18n/locale/oslo_i18n.pot
|
||||
|
||||
[extract_messages]
|
||||
keywords = _ gettext ngettext l_ lazy_gettext _C:1c,2 _P:1,2
|
||||
mapping_file = babel.cfg
|
||||
output_file = oslo.i18n/locale/oslo.i18n.pot
|
||||
output_file = oslo_i18n/locale/oslo_i18n.pot
|
||||
|
||||
[pbr]
|
||||
warnerrors = True
|
||||
|
Loading…
Reference in New Issue
Block a user