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:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
*.mo
|
||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
*.sqlite3
|
*.sqlite3
|
||||||
|
|||||||
47
run_tests.sh
47
run_tests.sh
@@ -22,8 +22,9 @@ function usage {
|
|||||||
echo " environment. Useful when dependencies have"
|
echo " environment. Useful when dependencies have"
|
||||||
echo " been added."
|
echo " been added."
|
||||||
echo " -m, --manage Run a Django management command."
|
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 " --compilemessages Compile all translation files."
|
||||||
|
echo " --check-only Do not update translation files (--makemessages only)."
|
||||||
echo " -p, --pep8 Just run pep8"
|
echo " -p, --pep8 Just run pep8"
|
||||||
echo " -t, --tabs Check for tab characters in files."
|
echo " -t, --tabs Check for tab characters in files."
|
||||||
echo " -y, --pylint Just run pylint"
|
echo " -y, --pylint Just run pylint"
|
||||||
@@ -76,6 +77,7 @@ testargs=""
|
|||||||
with_coverage=0
|
with_coverage=0
|
||||||
makemessages=0
|
makemessages=0
|
||||||
compilemessages=0
|
compilemessages=0
|
||||||
|
check_only=0
|
||||||
manage=0
|
manage=0
|
||||||
|
|
||||||
COVERAGE_CMD="python -m coverage.__main__"
|
COVERAGE_CMD="python -m coverage.__main__"
|
||||||
@@ -104,6 +106,7 @@ function process_option {
|
|||||||
-m|--manage) manage=1;;
|
-m|--manage) manage=1;;
|
||||||
--makemessages) makemessages=1;;
|
--makemessages) makemessages=1;;
|
||||||
--compilemessages) compilemessages=1;;
|
--compilemessages) compilemessages=1;;
|
||||||
|
--check-only) check_only=1;;
|
||||||
--only-selenium) only_selenium=1;;
|
--only-selenium) only_selenium=1;;
|
||||||
--with-selenium) with_selenium=1;;
|
--with-selenium) with_selenium=1;;
|
||||||
--docs) just_docs=1;;
|
--docs) just_docs=1;;
|
||||||
@@ -337,28 +340,40 @@ function run_tests_all {
|
|||||||
exit $(($MONASCA_UI_RESULT))
|
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 {
|
function run_makemessages {
|
||||||
cd horizon
|
|
||||||
${command_wrapper} $root/manage.py makemessages --all --no-obsolete
|
echo -n "monitoring: "
|
||||||
HORIZON_PY_RESULT=$?
|
cd monitoring
|
||||||
${command_wrapper} $root/manage.py makemessages -d djangojs --all --no-obsolete
|
babel_extract django
|
||||||
HORIZON_JS_RESULT=$?
|
MONITORING_PY_RESULT=$?
|
||||||
cd ../openstack_dashboard
|
|
||||||
${command_wrapper} $root/manage.py makemessages --all --no-obsolete
|
echo -n "monitoring javascript: "
|
||||||
DASHBOARD_RESULT=$?
|
babel_extract djangojs
|
||||||
|
MONITORING_JS_RESULT=$?
|
||||||
|
|
||||||
cd ..
|
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 {
|
function run_compilemessages {
|
||||||
cd horizon
|
cd monitoring
|
||||||
${command_wrapper} $root/manage.py compilemessages
|
${command_wrapper} $root/manage.py compilemessages
|
||||||
HORIZON_PY_RESULT=$?
|
MONITORING_RESULT=$?
|
||||||
cd ../openstack_dashboard
|
|
||||||
${command_wrapper} $root/manage.py compilemessages
|
|
||||||
DASHBOARD_RESULT=$?
|
|
||||||
cd ..
|
cd ..
|
||||||
exit $(($HORIZON_PY_RESULT || $DASHBOARD_RESULT))
|
exit $MONITORING_RESULT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user