Fix functions of translation

Fix function of update English po file
and function of compile the catalogs.

Change-Id: Ifb817d502d67f23caf9536f21ca23ba8e6663038
This commit is contained in:
Shinya Kawabata 2016-02-19 11:40:58 +09:00
parent 7a970689b8
commit 6bc7c635fa
2 changed files with 32 additions and 16 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.mo
*.pyc
*.swp
*.sqlite3

View File

@ -22,8 +22,9 @@ function usage {
echo " environment. Useful when dependencies have"
echo " been added."
echo " -m, --manage Run a Django management command."
echo " --makemessages Update all translation files."
echo " --makemessages Create/Update English translation files."
echo " --compilemessages Compile all translation files."
echo " --check-only Do not update translation files (--makemessages only)."
echo " -p, --pep8 Just run pep8"
echo " -t, --tabs Check for tab characters in files."
echo " -y, --pylint Just run pylint"
@ -76,6 +77,7 @@ testargs=""
with_coverage=0
makemessages=0
compilemessages=0
check_only=0
manage=0
COVERAGE_CMD="python -m coverage.__main__"
@ -104,6 +106,7 @@ function process_option {
-m|--manage) manage=1;;
--makemessages) makemessages=1;;
--compilemessages) compilemessages=1;;
--check-only) check_only=1;;
--only-selenium) only_selenium=1;;
--with-selenium) with_selenium=1;;
--docs) just_docs=1;;
@ -337,28 +340,40 @@ function run_tests_all {
exit $(($MONASCA_UI_RESULT))
}
function babel_extract {
DOMAIN=$1
KEYWORDS="-k gettext_noop -k gettext_lazy -k ngettext_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"
${command_wrapper} pybabel extract -F ../babel-${DOMAIN}.cfg -o locale/${DOMAIN}.pot $KEYWORDS .
}
function run_makemessages {
cd horizon
${command_wrapper} $root/manage.py makemessages --all --no-obsolete
HORIZON_PY_RESULT=$?
${command_wrapper} $root/manage.py makemessages -d djangojs --all --no-obsolete
HORIZON_JS_RESULT=$?
cd ../openstack_dashboard
${command_wrapper} $root/manage.py makemessages --all --no-obsolete
DASHBOARD_RESULT=$?
echo -n "monitoring: "
cd monitoring
babel_extract django
MONITORING_PY_RESULT=$?
echo -n "monitoring javascript: "
babel_extract djangojs
MONITORING_JS_RESULT=$?
cd ..
exit $(($HORIZON_PY_RESULT || $HORIZON_JS_RESULT || $DASHBOARD_RESULT))
if [ $check_only -eq 1 ]; then
git checkout -- monitoring/locale/django*.pot
fi
exit $(($MONITORING_PY_RESULT || $MONITORING_JS_RESULT))
}
function run_compilemessages {
cd horizon
cd monitoring
${command_wrapper} $root/manage.py compilemessages
HORIZON_PY_RESULT=$?
cd ../openstack_dashboard
${command_wrapper} $root/manage.py compilemessages
DASHBOARD_RESULT=$?
MONITORING_RESULT=$?
cd ..
exit $(($HORIZON_PY_RESULT || $DASHBOARD_RESULT))
exit $MONITORING_RESULT
}