| Revision 705,
1.4 KB
checked in by fma, 5 years ago
(diff) |
|
Rebuild po/mo file only if modified
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #/bin/sh |
|---|
| 2 | |
|---|
| 3 | APP_NAME="papywizard" |
|---|
| 4 | TMP_DIR="tmp" |
|---|
| 5 | POT_FILE="$APP_NAME.pot" |
|---|
| 6 | PO_FILE="$APP_NAME.po" |
|---|
| 7 | MO_FILE="$APP_NAME.mo" |
|---|
| 8 | LOCALE_DIR="locale" |
|---|
| 9 | |
|---|
| 10 | mkdir -p $TMP_DIR |
|---|
| 11 | |
|---|
| 12 | # Extract strings from python files |
|---|
| 13 | python_files="scripts/papywiz.py" |
|---|
| 14 | python_files="$python_files `find papywizard -type f -name \"*.py\"`" |
|---|
| 15 | |
|---|
| 16 | xgettext --language=Python --from-code=utf-8 --default-domain=$APP_NAME --keyword=_ --no-wrap --output=$TMP_DIR/$APP_NAME $python_files |
|---|
| 17 | |
|---|
| 18 | # Extract strings from glade files |
|---|
| 19 | glade_files=`ls papywizard/view/*.glade` |
|---|
| 20 | for file in $glade_files; do |
|---|
| 21 | intltool-extract -l --type=gettext/glade $file |
|---|
| 22 | done |
|---|
| 23 | |
|---|
| 24 | xgettext --language=Python --from-code=utf-8 --default-domain=$APP_NAME --keyword=_ --keyword=N_ --no-wrap --output=$TMP_DIR/$POT_FILE $python_files $TMP_DIR/*.h |
|---|
| 25 | |
|---|
| 26 | # Generate PO and MO files |
|---|
| 27 | for lang in 'en' 'fr'; do |
|---|
| 28 | if [ $LOCALE_DIR/$lang/LC_MESSAGES/$PO_FILE -nt $LOCALE_DIR/$lang/LC_MESSAGES/$MO_FILE ]; then |
|---|
| 29 | mkdir -p $LOCALE_DIR/$lang/LC_MESSAGES |
|---|
| 30 | if [ -e $LOCALE_DIR/$lang/LC_MESSAGES/$PO_FILE ]; then |
|---|
| 31 | msgmerge -U $LOCALE_DIR/$lang/LC_MESSAGES/$PO_FILE $TMP_DIR/$POT_FILE |
|---|
| 32 | else |
|---|
| 33 | msginit --input=$TMP_DIR/$POT_FILE --locale=$lang --no-translator --no-wrap --output=$LOCALE_DIR/$lang/LC_MESSAGES/$PO_FILE |
|---|
| 34 | fi |
|---|
| 35 | msgfmt -v --output-file=$LOCALE_DIR/$lang/LC_MESSAGES/$MO_FILE $LOCALE_DIR/$lang/LC_MESSAGES/$PO_FILE |
|---|
| 36 | fi |
|---|
| 37 | done |
|---|
Note: See
TracBrowser
for help on using the repository browser.