Skip to content

Instantly share code, notes, and snippets.

@pixline
Forked from mamchenkov/update_translations.sh
Created June 29, 2013 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixline/5891686 to your computer and use it in GitHub Desktop.
Save pixline/5891686 to your computer and use it in GitHub Desktop.
#!/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