From ef5a1a9c49b8137c18455b2f96f6aad1ecf6f2e2 Mon Sep 17 00:00:00 2001 From: Liuqing Jing Date: Sun, 21 Feb 2016 03:30:16 -0500 Subject: [PATCH] Add translation support for tacker-horizon This patch adds translation support as suggested by the global guidelines. Change-Id: I661ba2e3b39038663d2e1260e50d6bc82305ac96 --- babel-django.cfg | 5 +++++ babel-djangojs.cfg | 14 ++++++++++++++ openstack_dashboard_extensions/_80_nfv.py | 1 + tox.ini | 5 +++++ 4 files changed, 25 insertions(+) create mode 100644 babel-django.cfg create mode 100644 babel-djangojs.cfg diff --git a/babel-django.cfg b/babel-django.cfg new file mode 100644 index 0000000..e78d6c0 --- /dev/null +++ b/babel-django.cfg @@ -0,0 +1,5 @@ +[extractors] +django = django_babel.extract:extract_django + +[python: **.py] +[django: **/templates/**.html] diff --git a/babel-djangojs.cfg b/babel-djangojs.cfg new file mode 100644 index 0000000..a8273b6 --- /dev/null +++ b/babel-djangojs.cfg @@ -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] diff --git a/openstack_dashboard_extensions/_80_nfv.py b/openstack_dashboard_extensions/_80_nfv.py index 0fead86..983e87b 100644 --- a/openstack_dashboard_extensions/_80_nfv.py +++ b/openstack_dashboard_extensions/_80_nfv.py @@ -1,5 +1,6 @@ DASHBOARD = 'nfv' DISABLED = False ADD_INSTALLED_APPS = [ + 'tacker_horizon', 'tacker_horizon.openstack_dashboard.dashboards.nfv', ] diff --git a/tox.ini b/tox.ini index a3e7973..a800b1d 100644 --- a/tox.ini +++ b/tox.ini @@ -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