Created
April 23, 2014 22:02
-
-
Save guelau/11233994 to your computer and use it in GitHub Desktop.
This script get PHP gettext string (finds the "__" function) and merges them in .po files.
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 | |
XGETTEXT=/usr/bin/xgettext | |
XMESGMERG=/usr/bin/msgmerge | |
DOMAIN="messages.po" | |
TEMPLATE="messages.pot" | |
if [ ! -e "$1" ]; then | |
touch $1 | |
fi | |
find . -type f -iname "*.php" -o -iname "*.phtml" | $XGETTEXT -p $1 -o $TEMPLATE -L php -j --keyword=__ -n --from-code=utf-8 -f - | |
find $1 -type f -iname $DOMAIN > ./messages.tmp | |
while read fichier | |
do | |
$XMESGMERG -o $fichier $fichier "$1/$TEMPLATE" | |
done < ./messages.tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment