Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gettext translations update
#!/bin/bash
DOMAIN="easyforex"
POT="$DOMAIN.pot"
LANGS="en_US ru_RU"
SOURCES="*.php"
# Create template
echo "Creating POT"
rm -f $POT
xgettext \
--copyright-holder="2012 Easy Forex Ltd" \
--package-name="Easy Forex WordPress CMS" \
--package-version="1.0" \
--msgid-bugs-address="leonidm@easy-forex.com" \
--language=PHP \
--sort-output \
--no-wrap \
--keyword=__ \
--keyword=_e \
--from-code=UTF-8 \
--output=$POT \
--default-domain=$DOMAIN \
$SOURCES
# Create languages
for LANG in $LANGS
do
if [ ! -e "$LANG.po" ]
then
echo "Creating language file for $LANG"
msginit --no-translator --no-wrap --locale=$LANG.UTF-8 --output-file=$LANG.po --input=$POT
fi
echo "Updating language file for $LANG from $POT"
msgmerge --sort-output --no-wrap --update --backup=off $LANG.po $POT
echo "Converting $LANG.po to $LANG.mo"
msgfmt --check --verbose --output-file=$LANG.mo $LANG.po
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.