diff --git a/locale/gettext.sh b/locale/gettext.sh index d9c7a314..bc748799 100755 --- a/locale/gettext.sh +++ b/locale/gettext.sh @@ -6,15 +6,8 @@ # Should be run from repo root; ./locale/gettext.sh # -PHP="about.php data.php donate.php faq.php index.php sidebar.php help/*php html/*php php/*php" -JS="openflights.js js/alsearch.js js/apsearch.js js/functions.js js/settings.js js/trip.js" -OPTS="--omit-header --no-location --no-wrap -j" - -for lang in de_DE en_GB en_US es_ES fi_FI fr_FR ja_JP lt_LT nl_NL pl_PL pt_BR sv_SE ru_RU; do - PO_PATH=locale/$lang.utf8/LC_MESSAGES - echo $lang - - PO_NEW=$PO_PATH/new.po +buildlocale() { + PO_NEW=$1/new.po touch $PO_NEW xgettext $OPTS -o $PO_NEW $PHP @@ -25,17 +18,22 @@ for lang in de_DE en_GB en_US es_ES fi_FI fr_FR ja_JP lt_LT nl_NL pl_PL pt_BR sv PO_MESSAGES=$PO_PATH/messages.po msgmerge -N $PO_MESSAGES $PO_NEW >$PO_NEWEST - grep -v ^#~ $PO_NEWEST >$PO_MESSAGES + grep -v "^#~" $PO_NEWEST >$PO_MESSAGES rm $PO_NEW $PO_NEWEST # Make .mo files MO_FILE=$PO_PATH/messages.mo msgfmt -o $MO_FILE $PO_MESSAGES +} + +PHP="about.php data.php donate.php faq.php index.php sidebar.php help/*php html/*php php/*php" +JS="openflights.js js/alsearch.js js/apsearch.js js/functions.js js/settings.js js/trip.js" +OPTS="--omit-header --no-location --no-wrap -j" + +for lang in de_DE en_GB en_US es_ES fi_FI fr_FR ja_JP lt_LT nl_NL pl_PL pt_BR sv_SE ru_RU; do + echo $lang + PO_PATH=locale/$lang.utf8/LC_MESSAGES + buildlocale $PO_PATH done -touch locale/new.po -xgettext $OPTS -o locale/template.pot $PHP -xgettext $OPTS -L C -o locale/template.pot $JS -msgmerge -N locale/template.pot locale/new.po >locale/newest.po -grep -v "^#~" locale/newest.po >locale/messages.po -rm locale/new.po locale/newest.po +buildlocale locale \ No newline at end of file