diff --git a/apps/susidns/locale/messages_de.po b/apps/susidns/locale/messages_de.po new file mode 100644 index 0000000000..6685ad87f5 --- /dev/null +++ b/apps/susidns/locale/messages_de.po @@ -0,0 +1,22 @@ +# I2P +# Copyright (C) 2009 The I2P Project +# This file is distributed under the same license as the susidns package. +# To contribute translations, see http://www.i2p2.de/newdevelopers +# foo , 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: I2P susidns\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-12-10 01:53+0000\n" +"PO-Revision-Date: 2009-10-19 12:50+0000\n" +"Last-Translator: foo \n" +"Language-Team: foo \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: German\n" + +#: ../src/tmp/i2p/susi/dns/jsp/index_jsp.java:88 +msgid "Introduction - SusiDNS" +msgstr "" diff --git a/apps/susidns/src/bmsg.sh b/apps/susidns/src/bmsg.sh new file mode 100644 index 0000000000..b9d294b323 --- /dev/null +++ b/apps/susidns/src/bmsg.sh @@ -0,0 +1,17 @@ +# +# Update messages_xx.po and messages_xx.class files, +# from both java and jsp sources. +# Requires installed programs xgettext, msgfmt, msgmerge, and find. +# zzz - public domain +# + +## launching sh.exe with -login parameter will open a shell with the current path always pointing to \bin\ +## need to cd into our orignal path - where we call sh.exe from. + +cd $CALLFROM +## echo $PWD + +## except this everything is the same with bundle-message.sh +## walking - public domain :-D + +source bundle-messages.sh $PARAS \ No newline at end of file diff --git a/apps/susidns/src/build.xml b/apps/susidns/src/build.xml index a622f96c49..b0f7e96cf3 100644 --- a/apps/susidns/src/build.xml +++ b/apps/susidns/src/build.xml @@ -61,7 +61,7 @@ - + @@ -75,6 +75,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/susidns/src/bundle-messages.bat b/apps/susidns/src/bundle-messages.bat new file mode 100644 index 0000000000..90feca972a --- /dev/null +++ b/apps/susidns/src/bundle-messages.bat @@ -0,0 +1,26 @@ +@echo off +set Callfrom=%cd% +set Paras=%1 + +rem before calling make sure you have msys and mingw 's "bin" path +rem in your current searching path +rem type "set path" to check +if not exist ..\locale\*.only goto updateALL + +rem put a messages_xx.only(eg messages_zh.only) into locale folder +rem this script will only touch the po file(eg zh) you specified, leaving other po files untact. + +for %%i in (..\locale\*.only) do set PO=%%~ni +echo [Notice] Yu choose to Ony update the choosen file: %PO%.po +for %%i in (..\locale\*.po) do if not %%~ni==%PO% ren %%i %%~ni.po- + +call sh --login %cd%\bmsg.sh + +for %%i in (..\locale\*.po-) do if not %%~ni==%PO% ren %%i %%~ni.po +goto end + +:updateALL +call sh --login %cd%\bmsg.sh + +:end +echo End of Message Bundling \ No newline at end of file diff --git a/apps/susidns/src/bundle-messages.sh b/apps/susidns/src/bundle-messages.sh new file mode 100755 index 0000000000..e21706e880 --- /dev/null +++ b/apps/susidns/src/bundle-messages.sh @@ -0,0 +1,87 @@ +# +# Update messages_xx.po and messages_xx.class files, +# from both java and jsp sources. +# Requires installed programs xgettext, msgfmt, msgmerge, and find. +# +# usage: +# bundle-messages.sh (generates the resource bundle from the .po file) +# bundle-messages.sh -p (updates the .po file from the source tags, then generates the resource bundle) +# +# zzz - public domain +# +CLASS=i2p.susi.dns.messages +TMPFILE=tmp/javafiles.txt +export TZ=UTC + +if [ "$1" = "-p" ] +then + POUPDATE=1 +fi + +# add ../src/ so the refs will work in the po file +JPATHS="../src/java/ ../src/tmp/" +for i in ../locale/messages_*.po +do + # get language + LG=${i#../locale/messages_} + LG=${LG%.po} + + if [ "$POUPDATE" = "1" ] + then + # make list of java files newer than the .po file + find $JPATHS -name *.java -newer $i > $TMPFILE + fi + + if [ -s WEB-INF/classes/i2p/susi/dns/messages_$LG.class -a \ + WEB-INF/classes/i2p/susi/dns/messages_$LG.class -nt $i -a \ + ! -s $TMPFILE ] + then + continue + fi + + 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") + # 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 \ + -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 + + echo "Generating ${CLASS}_$LG ResourceBundle..." + + # convert to class files in build/obj + msgfmt --java -r $CLASS -l $LG -d WEB-INF/classes $i + if [ $? -ne 0 ] + then + echo 'Warning - msgfmt failed, not updating translations' + break + fi +done +rm -f $TMPFILE +# todo: return failure +exit 0 diff --git a/apps/susidns/src/jsp/index.jsp b/apps/susidns/src/jsp/index.jsp index debd97c138..795dd7373b 100644 --- a/apps/susidns/src/jsp/index.jsp +++ b/apps/susidns/src/jsp/index.jsp @@ -26,10 +26,11 @@ <%@ page contentType="text/html"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + -introduction - susidns v${version.version} +<%=intl._("Introduction - SusiDNS")%> v${version.version} diff --git a/build.xml b/build.xml index 13de3a1b49..363d3786f1 100644 --- a/build.xml +++ b/build.xml @@ -143,6 +143,7 @@ +