From 56e0c3e047881fc7eecfac222e10a760f503bc9c Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 18 Nov 2009 14:16:36 +0000 Subject: [PATCH] * Build: Don't update the po files by default, add new target "poupdate" to do that. --- apps/routerconsole/java/build.xml | 18 +++++ apps/routerconsole/java/bundle-messages.sh | 92 +++++++++++++--------- build.xml | 4 + 3 files changed, 77 insertions(+), 37 deletions(-) diff --git a/apps/routerconsole/java/build.xml b/apps/routerconsole/java/build.xml index 747874ef4..3db3038ea 100644 --- a/apps/routerconsole/java/build.xml +++ b/apps/routerconsole/java/build.xml @@ -89,6 +89,24 @@ + + + + + + + + + + + + + + + + + $TMPFILE + if [ "$POUPDATE" = "1" ] + then + # make list of java files newer than the .po file + find $JPATHS -name *.java -newer $i > $TMPFILE + fi + if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a \ build/obj/net/i2p/router/web/messages_$LG.class -nt $i -a \ ! -s $TMPFILE ] @@ -46,42 +60,46 @@ do continue fi - echo "Generating ${CLASS}_$LG ResourceBundle..." + if [ "$POUPDATE" = "1" ] + then + echo "Updating the $i file from the tags..." + # extract strings from java and jsp files, and update messages.po files + # translate calls must be one of the forms: + # _("foo") + # _x("foo") + # intl._("foo") + # intl.title("foo") + # handler._("foo") + # formhandler._("foo") + # net.i2p.router.web.Messages.getString("foo") + # In a jsp, you must use a helper or handler that has the context set. + # To start a new translation, copy the header from an old translation to the new .po file, + # then ant distclean updater. + find $JPATHS -name *.java > $TMPFILE + xgettext -f $TMPFILE -F -L java --from-code=UTF-8 \ + --keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \ + --keyword=handler._ --keyword=formhandler._ \ + --keyword=net.i2p.router.web.Messages.getString \ + -o ${i}t + if [ $? -ne 0 ] + then + echo 'Warning - xgettext failed, not updating translations' + rm -f ${i}t + break + fi + msgmerge -U --backup=none $i ${i}t + if [ $? -ne 0 ] + then + echo 'Warning - msgmerge failed, not updating translations' + rm -f ${i}t + break + fi + rm -f ${i}t + # so we don't do this again + touch $i + fi - # extract strings from java and jsp files, and update messages.po files - # translate calls must be one of the forms: - # _("foo") - # _x("foo") - # intl._("foo") - # intl.title("foo") - # handler._("foo") - # formhandler._("foo") - # net.i2p.router.web.Messages.getString("foo") - # In a jsp, you must use a helper or handler that has the context set. - # To start a new translation, copy the header from an old translation to the new .po file, - # then ant distclean updater. - find $JPATHS -name *.java > $TMPFILE - xgettext -f $TMPFILE -F -L java --from-code=UTF-8 \ - --keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \ - --keyword=handler._ --keyword=formhandler._ \ - --keyword=net.i2p.router.web.Messages.getString \ - -o ${i}t - if [ $? -ne 0 ] - then - echo 'Warning - xgettext failed, not updating translations' - rm -f ${i}t - break - fi - msgmerge -U --backup=none $i ${i}t - if [ $? -ne 0 ] - then - echo 'Warning - msgmerge failed, not updating translations' - rm -f ${i}t - break - fi - rm -f ${i}t - # so we don't do this again - touch $i + echo "Generating ${CLASS}_$LG ResourceBundle..." # convert to class files in build/obj msgfmt --java -r $CLASS -l $LG -d build/obj $i diff --git a/build.xml b/build.xml index 4ea82687d..f2e27b1df 100644 --- a/build.xml +++ b/build.xml @@ -32,6 +32,7 @@ + @@ -138,6 +139,9 @@ + + +