forked from I2P_Developers/i2p.i2p
translation support
This commit is contained in:
22
apps/susidns/locale/messages_de.po
Normal file
22
apps/susidns/locale/messages_de.po
Normal file
@ -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 <foo@bar>, 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 <foo@bar>\n"
|
||||||
|
"Language-Team: foo <foo@bar>\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 ""
|
17
apps/susidns/src/bmsg.sh
Normal file
17
apps/susidns/src/bmsg.sh
Normal file
@ -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
|
@ -61,7 +61,7 @@
|
|||||||
<srcfiles dir= "." includes="jsp/*.jsp, WEB-INF/web-template.xml"/>
|
<srcfiles dir= "." includes="jsp/*.jsp, WEB-INF/web-template.xml"/>
|
||||||
</uptodate>
|
</uptodate>
|
||||||
|
|
||||||
<target name="all" depends="compile,precompilejsp,war"/>
|
<target name="all" depends="compile,precompilejsp,bundle,war"/>
|
||||||
<target name="war">
|
<target name="war">
|
||||||
<war destfile="${project}.war" webxml="WEB-INF/web-out.xml">
|
<war destfile="${project}.war" webxml="WEB-INF/web-out.xml">
|
||||||
<fileset dir=".">
|
<fileset dir=".">
|
||||||
@ -75,6 +75,39 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</war>
|
</war>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="bundle" depends="compile, precompilejsp">
|
||||||
|
<!-- Update the messages_*.po files.
|
||||||
|
We need to supply the bat file for windows, and then change the fail property to true -->
|
||||||
|
<exec executable="sh" osfamily="unix" failifexecutionfails="false" >
|
||||||
|
<arg value="./bundle-messages.sh" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="sh" osfamily="mac" failifexecutionfails="false" >
|
||||||
|
<arg value="./bundle-messages.sh" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="cmd" osfamily="windows" failifexecutionfails="false" >
|
||||||
|
<arg value="/c" />
|
||||||
|
<arg value="bundle-messages.bat" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="poupdate" depends="compile, precompilejsp">
|
||||||
|
<!-- Update the messages_*.po files. -->
|
||||||
|
<exec executable="sh" osfamily="unix" failifexecutionfails="true" >
|
||||||
|
<arg value="./bundle-messages.sh" />
|
||||||
|
<arg value="-p" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="sh" osfamily="mac" failifexecutionfails="true" >
|
||||||
|
<arg value="./bundle-messages.sh" />
|
||||||
|
<arg value="-p" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="cmd" osfamily="windows" failifexecutionfails="true" >
|
||||||
|
<arg value="/c" />
|
||||||
|
<arg value="bundle-messages.bat" />
|
||||||
|
<arg value="-p" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete file="susidns.war" />
|
<delete file="susidns.war" />
|
||||||
<delete>
|
<delete>
|
||||||
|
26
apps/susidns/src/bundle-messages.bat
Normal file
26
apps/susidns/src/bundle-messages.bat
Normal file
@ -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
|
87
apps/susidns/src/bundle-messages.sh
Executable file
87
apps/susidns/src/bundle-messages.sh
Executable file
@ -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
|
@ -26,10 +26,11 @@
|
|||||||
<%@ page contentType="text/html"%>
|
<%@ page contentType="text/html"%>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
<jsp:useBean id="version" class="i2p.susi.dns.VersionBean" scope="application" />
|
<jsp:useBean id="version" class="i2p.susi.dns.VersionBean" scope="application" />
|
||||||
|
<jsp:useBean id="intl" class="i2p.susi.dns.Messages" scope="application" />
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>introduction - susidns v${version.version}</title>
|
<title><%=intl._("Introduction - SusiDNS")%> v${version.version}</title>
|
||||||
<link rel="stylesheet" type="text/css" href="css.css">
|
<link rel="stylesheet" type="text/css" href="css.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -143,6 +143,7 @@
|
|||||||
<ant dir="apps/routerconsole/java/" target="poupdate" />
|
<ant dir="apps/routerconsole/java/" target="poupdate" />
|
||||||
<ant dir="apps/i2psnark/java/" target="poupdate" />
|
<ant dir="apps/i2psnark/java/" target="poupdate" />
|
||||||
<ant dir="apps/i2ptunnel/java/" target="poupdate" />
|
<ant dir="apps/i2ptunnel/java/" target="poupdate" />
|
||||||
|
<ant dir="apps/susidns/src/" target="poupdate" />
|
||||||
</target>
|
</target>
|
||||||
<target name="javadoc">
|
<target name="javadoc">
|
||||||
<mkdir dir="./build" />
|
<mkdir dir="./build" />
|
||||||
|
Reference in New Issue
Block a user