added i8ndude and script to buildout in order to make translations updates simpler.

This commit is contained in:
Jens W. Klein 2014-03-25 18:33:48 +01:00
parent 96bf7ca002
commit 79ad7816c4
1 changed files with 18 additions and 35 deletions

View File

@ -6,6 +6,7 @@ parts +=
mkrelease mkrelease
pocompile pocompile
code-analysis code-analysis
i18ndude
update_translations update_translations
[mkrelease] [mkrelease]
@ -31,49 +32,31 @@ plone.app.jquery = 1.8.3
plone.app.testing = 4.2.4 plone.app.testing = 4.2.4
plone.app.vocabularies = 2.1.14 plone.app.vocabularies = 2.1.14
[babelpy]
[i18ndude]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = eggs =
setuptools i18ndude
Babel
lingua
interpreter = babelpy
[update_translations] [update_translations]
recipe = collective.recipe.template recipe = collective.recipe.template
output = ${buildout:directory}/bin/update_translations output = ${buildout:bin-directory}/update_translations
input = inline: input = inline:
#!/bin/bash #!/usr/bin/env bash
DOMAIN="plone"
DOMAIN="plone.app.discussion"
BASE_PATH=${buildout:directory}/plone/app/discussion BASE_PATH=${buildout:directory}/plone/app/discussion
# --- No modifications below --- I18NDUDE=${buildout:bin-directory}/i18ndude
[[ -s $BASE_PATH/locales/$DOMAIN.pot ]] && \
cp $BASE_PATH/locales/$DOMAIN.pot $BASE_PATH/locales/$DOMAIN.1.pot $I18NDUDE rebuild-pot --pot $BASE_PATH/locales/$DOMAIN.pot --create "$DOMAIN" $BASE_PATH*
${buildout:directory}/bin/${babelpy:interpreter} \ $I18NDUDE rebuild-pot --pot $BASE_PATH/i18n/plone.pot --create "plone" $BASE_PATH/profiles/
${buildout:directory}/setup.py extract_messages \
-o $BASE_PATH/locales/$DOMAIN.pot
if [ ! -s $BASE_PATH/locales/$DOMAIN.pot ]; then
[[ -s $BASE_PATH/locales/$DOMAIN.1.pot ]] && \
mv $BASE_PATH/locales/$DOMAIN.1.pot $BASE_PATH/locales/$DOMAIN.pot
echo -e "\033[0;31mERROR\033[0m: Restored old .pot file due template errors."
exit 1
fi
[[ -s $BASE_PATH/locales/$DOMAIN.1.pot ]] && \
rm $BASE_PATH/locales/$DOMAIN.1.pot
# sync all locales, create if they do not exist
for LANG in `find $BASE_PATH/locales -maxdepth 1 -mindepth 1 -type d \ for LANG in `find $BASE_PATH/locales -maxdepth 1 -mindepth 1 -type d \
| grep -v .svn \ | sed -e "s/.*locales\/\(.*\)$/\1/"`; do
| sed -e "s/.*locales\/\(.*\)$/\1/"`; do $I18NDUDE sync --pot $BASE_PATH/locales/$DOMAIN.pot $BASE_PATH/locales/de/LC_MESSAGES/$DOMAIN.po
if [ ! -f $BASE_PATH/locales/$LANG/LC_MESSAGES/$DOMAIN.po ]; then msgfmt --no-hash -o $BASE_PATH/locales/$LANG/LC_MESSAGES/$DOMAIN.mo $BASE_PATH/locales/$LANG/LC_MESSAGES/$DOMAIN.po
echo -e "\033[0;32mINFO\033[0m: Create $BASE_PATH/locales/$LANG/LC_MESSAGES/$DOMAIN.po."
touch $BASE_PATH/locales/$LANG/LC_MESSAGES/$DOMAIN.po $I18NDUDE sync --pot $BASE_PATH/i18n/plone.pot $BASE_PATH/i18n/plone-$LANG.po
fi msgfmt --no-hash -o $BASE_PATH/i18n/plone-$LANG.mo $BASE_PATH/i18n/plone-$LANG.po
${buildout:directory}/bin/${babelpy:interpreter} \
${buildout:directory}/setup.py update_catalog \
-l $LANG -i $BASE_PATH/locales/$DOMAIN.pot \
-o $BASE_PATH/locales/$LANG/LC_MESSAGES/$DOMAIN.po
echo -e "\033[0;32mINFO ($LANG)\033[0m: $BASE_PATH/locales/$LANG/LC_MESSAGES/$DOMAIN.po synced."
done done
mode = 755 mode = 755