Adds i18n machinery similar to the one used in horizon

Targets blueprint: murano-i18n

Change-Id: I1febd9404c4d99e4ef0cd30cf3e841df97847abe
This commit is contained in:
Kirill Zaitsev 2015-12-28 23:17:26 +03:00
parent 52356c91d0
commit a2305b69b4
6 changed files with 1431 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]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
# Translations template for PROJECT.
# Copyright (C) 2015 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2015-12-28 22:59+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.1.1\n"
#: muranodashboard/static/muranodashboard/js/draggable-components.js:200
msgid "Unable to run action."
msgstr ""
#: muranodashboard/static/muranodashboard/js/draggable-components.js:234
msgid "Waiting for a result"
msgstr ""
#: muranodashboard/static/muranodashboard/js/environments-in-place.js:21
msgid "Working"
msgstr ""
#: muranodashboard/static/muranodashboard/js/load-modals.js:25
msgid "Loading"
msgstr ""
#: muranodashboard/static/muranodashboard/js/load-modals.js:44
msgid "An error occurred. Please try again later."
msgstr ""
#: muranodashboard/static/muranodashboard/js/murano.service.js:68
msgid "Unable to retrieve the packages."
msgstr ""

View File

@ -14,3 +14,7 @@ yaql>=1.0.0 # Apache 2.0 License
oslo.log>=1.12.0 # Apache-2.0
semantic-version>=2.3.1
# message extraction
Babel>=1.3
django-babel>=0.4.0

View File

@ -44,6 +44,11 @@ commands = nodeenv -p
[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:makemessages]
commands =
pybabel extract -F babel-django.cfg -o muranodashboard/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 muranodashboard
pybabel extract -F babel-djangojs.cfg -o muranodashboard/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 muranodashboard
[flake8]
# H104 File contains nothing but comments
ignore = H104