Add translation support for tacker-horizon

This patch adds translation support as suggested by the global
guidelines.

Change-Id: I661ba2e3b39038663d2e1260e50d6bc82305ac96
This commit is contained in:
Liuqing Jing 2016-02-21 03:30:16 -05:00
parent 2b5c7d9a79
commit ef5a1a9c49
4 changed files with 25 additions and 0 deletions

5
babel-django.cfg Normal file
View File

@ -0,0 +1,5 @@
[extractors]
django = django_babel.extract:extract_django
[python: **.py]
[django: **/templates/**.html]

14
babel-djangojs.cfg Normal file
View File

@ -0,0 +1,14 @@
[extractors]
# We use a custom extractor to find translatable strings in AngularJS
# templates. The extractor is included in horizon.utils for now.
# See http://babel.pocoo.org/docs/messages/#referencing-extraction-methods for
# details on how this works.
angular = horizon.utils.babel_extract_angular:extract_angular
[javascript: **.js]
# We need to look into all static folders for HTML files.
# The **/static ensures that we also search within
# /openstack_dashboard/dashboards/XYZ/static which will ensure
# that plugins are also translated.
[angular: **/static/**.html]

View File

@ -1,5 +1,6 @@
DASHBOARD = 'nfv'
DISABLED = False
ADD_INSTALLED_APPS = [
'tacker_horizon',
'tacker_horizon.openstack_dashboard.dashboards.nfv',
]

View File

@ -49,3 +49,8 @@ commands = {posargs}
[flake8]
show-source = True
max-complexity = 20
[testenv:makemessages]
commands =
pybabel extract -F babel-django.cfg -o tacker_horizon/locale/django.pot -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2 -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2 -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3 tacker_horizon
pybabel extract -F babel-djangojs.cfg -o tacker_horizon/locale/djangojs.pot -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2 -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2 -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3 tacker_horizon