Skip to content

Instantly share code, notes, and snippets.

@mpj
Created September 23, 2010 13:53
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 mpj/593638 to your computer and use it in GitHub Desktop.
Save mpj/593638 to your computer and use it in GitHub Desktop.
# This script accepts one or more directories and find all .as and .mxml files in them, and extracts
# gettext marked strings from them. It also finds string that are NOT marked with gettext, and puts
# them in a separate file, for easy finding of strings that we have missed to internationalize.
# create a list of all .as and .mxml files and put the list into files4i18n
find $* | egrep -i '\.as$|\.mxml$' > files4i18n
echo "Extracting marked strings and putting them into template.pot"
xgettext -f files4i18n --keyword=LC:1c,2 --from-code=UTF-8 -o template.pot --add-comments='TRANSLATOR' --language=python
# We parse as python, since there is no offical support for ActionsScript. This works, with the minor exception that it won't
# accept single quotes inside comments, but we'll (we will) live with that.
echo "Detecting unmarked strings and putting them into unmarked.pot"
xgettext -f files4i18n --keyword=LC:1 --from-code=UTF-8 -o keys.pot --language=python
xgettext -f files4i18n --keyword=LC:2 --from-code=UTF-8 -o values.pot --language=python
xgettext -f files4i18n --extract-all --from-code=UTF-8 -o all.pot --language=python
msgcomm --unique all.pot keys.pot values.pot > unmarked.pot --omit-header --force-po
# clean up
rm all.pot
rm keys.pot
rm values.pot
rm files4i18n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment