Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Search for locale string in source code, generate po files
- # Merge it with new loalization
- LANGLIST='cz de en it pl pt_br ro ru sk'
- DOMAIN='atollon'
- DOMAINS='atollon help'
- TEMP='/tmp/atollon'
- FILELIST='file-list.txt'
- mkdir -p $TEMP
- echo "=== Generate list of files ==="
- find ../.. -name '*.as' > $FILELIST
- echo "... list of *.as files finished"
- MXMLS=`find ../.. -name '*.mxml'`
- for i in $MXMLS; do
- TARGET=${TEMP}`echo $i | sed -E -e 's/^\.\.\/\.\.(.*)$/\1/'`
- TDIR=`echo $TARGET | sed -E -e 's/^(.*)\/[^\/]+$/\1/'`
- mkdir -p $TDIR
- sed -e 's/\(\w*=\)"\([^"]*{[^"]*}[^"]*\)"/\1\2/g' $i > $TARGET
- echo $TARGET >> $FILELIST
- printf "."
- done
- echo " list of *.mxml files finished"
- echo "=== Generate template ==="
- xgettext -f $FILELIST -L Python --keyword=pgettext:1c,2 --from-code=UTF-8 -p po -d $DOMAIN --no-wrap --msgid-bugs-address=islander@atollon.com --package-name='Atollon Lagoon' --copyright-holder='Atollon Ltd.' 2>>error.log
- xgettext -f $FILELIST -L Python --keyword --keyword=_help --from-code=UTF-8 -p po -d help --no-wrap --msgid-bugs-address=islander@atollon.com --package-name='Atollon Lagoon' --copyright-holder='Atollon Ltd.' 2>>error.log
- if [ $? -eq 0 ];
- then
- echo "done"
- echo "=== Merging translations ==="
- for DOMAIN in $DOMAINS; do
- TEMPLATE=po/$DOMAIN.po
- if [ -f $TEMPLATE ]; then
- for i in $LANGLIST; do
- DEFPO=po/${DOMAIN}_$i.po
- if [ -f $DEFPO ]; then
- msgmerge -U --backup=off $DEFPO $TEMPLATE
- else
- msginit -i $TEMPLATE -o $DEFPO -l $i --no-translator
- fi
- done
- fi
- done
- else
- echo "ERROR: Cannot generate strings. See error.log."
- fi
- echo "=== Cleaning up ==="
- #rm -Rf $TEMP
- rm $FILELIST
- echo "done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement