Created
September 10, 2012 13:41
-
-
Save mamchenkov/3690981 to your computer and use it in GitHub Desktop.
gettext translations update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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