Fix translation setup

We do not store pot files anymore in git. Fix run_tests.sh that expects
that these are in git. To restore normal content, just remove the
generated files.

Also, fix babel configurations.

Change-Id: I23680de0cf88d0a2fd957888bb2edae296dcf33d
This commit is contained in:
shu-mutou 2016-05-20 18:35:07 +09:00
parent 6a98731261
commit efb334fced
3 changed files with 9 additions and 7 deletions

View File

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

View File

@ -5,10 +5,10 @@
# details on how this works. # details on how this works.
angular = horizon.utils.babel_extract_angular:extract_angular angular = horizon.utils.babel_extract_angular:extract_angular
[javascript: zaqar_ui/**.js] [javascript: **.js]
# We need to look into all static folders for HTML files. # We need to look into all static folders for HTML files.
# The **/static ensures that we also search within # The **/static ensures that we also search within
# /openstack_dashboard/dashboards/XYZ/static which will ensure # /openstack_dashboard/dashboards/XYZ/static which will ensure
# that plugins are also translated. # that plugins are also translated.
[angular: zaqar_ui/**/static/**.html] [angular: **/static/**.html]

View File

@ -415,12 +415,13 @@ function babel_extract {
KEYWORDS+=" -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2" KEYWORDS+=" -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2"
KEYWORDS+=" -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3" KEYWORDS+=" -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3"
${command_wrapper} pybabel extract -F babel-${DOMAIN}.cfg -o zaqar_ui/locale/${DOMAIN}.pot $KEYWORDS . mkdir -p locale
${command_wrapper} pybabel extract -F ../babel-${DOMAIN}.cfg -o locale/${DOMAIN}.pot $KEYWORDS .
} }
function run_makemessages { function run_makemessages {
echo -n "zaqar ui: " echo -n "zaqar ui: "
cd zaqar_ui
babel_extract django babel_extract django
ZAQAR_PY_RESULT=$? ZAQAR_PY_RESULT=$?
@ -428,8 +429,9 @@ function run_makemessages {
babel_extract djangojs babel_extract djangojs
ZAQAR_JS_RESULT=$? ZAQAR_JS_RESULT=$?
cd ../
if [ $check_only -eq 1 ]; then if [ $check_only -eq 1 ]; then
git checkout -- zaqar_ui/locale/django*.pot rm -f zaqar_ui/locale/django*.pot
fi fi
exit $(($ZAQAR_PY_RESULT || $ZAQAR_JS_RESULT)) exit $(($ZAQAR_PY_RESULT || $ZAQAR_JS_RESULT))