translation infrastructure, thanks to zzz
This commit is contained in:
@ -66,9 +66,41 @@ task generateWebXML {
|
||||
}
|
||||
}
|
||||
|
||||
// compile the po files and put them in the jar
|
||||
task bundle {
|
||||
doLast {
|
||||
// run bundle-messages.sh
|
||||
println 'starting bundle-messages'
|
||||
println "webui/bundle-messages.sh".execute().text
|
||||
println 'finished bundle-messages'
|
||||
// compile java files in build/messages-src
|
||||
ant.mkdir(dir: "$buildDir/compiledMessages")
|
||||
ant.javac(srcDir: "$buildDir/messages-src",
|
||||
classPath : sourceSets.main.runtimeClasspath.asPath,
|
||||
includeAntRuntime : false,
|
||||
destDir:file("$buildDir/compiledMessages"))
|
||||
// add resulting classes to build/libs/webui-(version).jar
|
||||
ant.jar(destfile: "$buildDir/libs/webui-${version}.jar",
|
||||
basedir: "$buildDir/compiledMessages",
|
||||
includes: '**/messages_*.class',
|
||||
update: 'true')
|
||||
}
|
||||
}
|
||||
|
||||
// rebuild the english po file for uploading to transifex
|
||||
task poupdate {
|
||||
doLast {
|
||||
// run bundle-messages.sh
|
||||
println 'starting bundle-messages -p'
|
||||
println "webui/bundle-messages.sh -p".execute().text
|
||||
println 'finished bundle-messages -p'
|
||||
}
|
||||
}
|
||||
|
||||
precompileJsp.dependsOn compileJava
|
||||
generateWebXML.dependsOn precompileJsp
|
||||
war.dependsOn generateWebXML
|
||||
bundle.dependsOn precompileJsp
|
||||
war.dependsOn generateWebXML, bundle
|
||||
|
||||
artifacts {
|
||||
warArtifact war
|
||||
|
142
webui/bundle-messages.sh
Normal file
142
webui/bundle-messages.sh
Normal file
@ -0,0 +1,142 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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
|
||||
#
|
||||
cd `dirname $0`
|
||||
echo "bundle messages in $PWD"
|
||||
CLASS=com.muwire.webui.messages
|
||||
TMPFILE=build/javafiles.txt
|
||||
export TZ=UTC
|
||||
RC=0
|
||||
|
||||
if ! $(which javac > /dev/null 2>&1); then
|
||||
export JAVAC=${JAVA_HOME}/../bin/javac
|
||||
fi
|
||||
|
||||
if [ "$1" = "-p" ]
|
||||
then
|
||||
POUPDATE=1
|
||||
fi
|
||||
|
||||
# on windows, one must specify the path of commnad find
|
||||
# since windows has its own version of find.
|
||||
if which find|grep -q -i windows ; then
|
||||
export PATH=.:/bin:/usr/local/bin:$PATH
|
||||
fi
|
||||
# Fast mode - update ondemond
|
||||
# set LG2 to the language you need in environment variables to enable this
|
||||
|
||||
# add ../src/ so the refs will work in the po file
|
||||
JPATHS="src/main/java/ build/tmp_jsp"
|
||||
for i in locale/messages_*.po
|
||||
do
|
||||
# get language
|
||||
LG=${i#locale/messages_}
|
||||
LG=${LG%.po}
|
||||
|
||||
# skip, if specified
|
||||
if [ $LG2 ]; then
|
||||
[ $LG != $LG2 ] && continue || echo INFO: Language update is set to [$LG2] only.
|
||||
fi
|
||||
|
||||
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/compiledJsps/com/muwire/webui/messages/messages_$LG.class -a \
|
||||
build/compiledJsps/com/muwire/webui/messages/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")
|
||||
# _t("foo")
|
||||
# _x("foo")
|
||||
# intl._t("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 --add-comments\
|
||||
--keyword=_ --keyword=_t --keyword=_x --keyword=intl._ --keyword=intl.title \
|
||||
-o ${i}t
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "ERROR - xgettext failed on ${i}, not updating translations"
|
||||
rm -f ${i}t
|
||||
RC=1
|
||||
break
|
||||
fi
|
||||
msgmerge -U --backup=none $i ${i}t
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "ERROR - msgmerge failed on ${i}, not updating translations"
|
||||
rm -f ${i}t
|
||||
RC=1
|
||||
break
|
||||
fi
|
||||
rm -f ${i}t
|
||||
# so we don't do this again
|
||||
touch $i
|
||||
fi
|
||||
|
||||
if [ "$LG" != "en" ]
|
||||
then
|
||||
# only generate for non-source language
|
||||
echo "Generating ${CLASS}_$LG ResourceBundle..."
|
||||
|
||||
msgfmt -V | grep -q -E ' 0\.((19)|[2-9])'
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
# slow way
|
||||
# convert to class files in WEB-INF/classes
|
||||
msgfmt --java --statistics -r $CLASS -l $LG -d build/compiledJsps $i
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "ERROR - msgfmt failed on ${i}, not updating translations"
|
||||
# msgfmt leaves the class file there so the build would work the next time
|
||||
find build/compiledJsps -name messages_${LG}.class -exec rm -f {} \;
|
||||
RC=1
|
||||
break
|
||||
fi
|
||||
else
|
||||
# fast way
|
||||
# convert to java files in build/messages-src
|
||||
TD=build/messages-src-tmp/
|
||||
TDX=$TD/com/muwire/webui
|
||||
TD2=build/messages-src
|
||||
TDY=$TD2/com/muwire/webui
|
||||
rm -rf $TD
|
||||
mkdir -p $TD $TDY
|
||||
msgfmt --java --statistics --source -r $CLASS -l $LG -d $TD $i
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "ERROR - msgfmt failed on ${i}, not updating translations"
|
||||
# msgfmt leaves the class file there so the build would work the next time
|
||||
find WEB-INF/classes -name messages_${LG}.class -exec rm -f {} \;
|
||||
RC=1
|
||||
break
|
||||
fi
|
||||
mv $TDX/messages_$LG.java $TDY
|
||||
rm -rf $TD
|
||||
fi
|
||||
fi
|
||||
done
|
||||
rm -f $TMPFILE
|
||||
exit $RC
|
168
webui/locale/messages_de.po
Normal file
168
webui/locale/messages_de.po
Normal file
@ -0,0 +1,168 @@
|
||||
# I2P
|
||||
# Copyright (C) 2009 The I2P Project
|
||||
# This file is distributed under the same license as the routerconsole package.
|
||||
# To contribute translations, see http://www.i2p2.de/newdevelopers
|
||||
# foo <foo@bar>, 2009.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: I2P MuWire\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-12-07 20:58+0000\n"
|
||||
"Language: de\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:141
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:169
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:178
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:203
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:159
|
||||
msgid "Downloads"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:156
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:169
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:141
|
||||
#: src/main/java/com/muwire/webui/MuWireServlet.java:64
|
||||
msgid "Welcome to MuWire"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:164
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:166
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:180
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:177
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:179
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:205
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:161
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:172
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:197
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:153
|
||||
msgid "Status"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:174
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:199
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:155
|
||||
msgid "Connections"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:176
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:201
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:157
|
||||
msgid "Pages"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:182
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:207
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:126
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:163
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:178
|
||||
msgid "Shared Files"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:184
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:209
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:165
|
||||
msgid "Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:186
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:211
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:167
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:188
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:213
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:169
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:190
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:215
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:171
|
||||
msgid "User Guide"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:192
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:217
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:173
|
||||
msgid "FAQ"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:194
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:219
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:175
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:197
|
||||
msgid "Download Details"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:199
|
||||
msgid "Click on a download to view details"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:141
|
||||
msgid "Home"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:184
|
||||
msgid "Active Searches By Sender"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:186
|
||||
msgid "Group By File"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:190
|
||||
msgid "Active Searches By File"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:192
|
||||
msgid "Group By Sender"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:222
|
||||
msgid "Results"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:137
|
||||
msgid "Welcome to MuWire! Please select a nickname and download locations"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:139
|
||||
msgid "Nickname"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:141
|
||||
msgid "Directory for saving downloaded files"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:145
|
||||
msgid "Directory for storing incomplete files"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:149
|
||||
msgid "Submit"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:148
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:150
|
||||
msgid "Share"
|
||||
msgstr ""
|
||||
|
||||
#: src/main/java/com/muwire/webui/MuWireServlet.java:57
|
||||
msgid "MuWire"
|
||||
msgstr ""
|
||||
|
||||
#: src/main/java/com/muwire/webui/MuWireServlet.java:68
|
||||
msgid "MuWire is initializing, please wait"
|
||||
msgstr ""
|
168
webui/locale/messages_en.po
Normal file
168
webui/locale/messages_en.po
Normal file
@ -0,0 +1,168 @@
|
||||
# I2P
|
||||
# Copyright (C) 2009 The I2P Project
|
||||
# This file is distributed under the same license as the routerconsole package.
|
||||
# To contribute translations, see http://www.i2p2.de/newdevelopers
|
||||
# foo <foo@bar>, 2009.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: I2P MuWire\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-12-07 20:58+0000\n"
|
||||
"Language: en\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:141
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:169
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:178
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:203
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:159
|
||||
msgid "Downloads"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:156
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:169
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:141
|
||||
#: src/main/java/com/muwire/webui/MuWireServlet.java:64
|
||||
msgid "Welcome to MuWire"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:164
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:166
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:180
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:177
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:179
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:205
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:161
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:172
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:197
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:153
|
||||
msgid "Status"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:174
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:199
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:155
|
||||
msgid "Connections"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:176
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:201
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:157
|
||||
msgid "Pages"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:182
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:207
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:126
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:163
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:178
|
||||
msgid "Shared Files"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:184
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:209
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:165
|
||||
msgid "Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:186
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:211
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:167
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:188
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:213
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:169
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:190
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:215
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:171
|
||||
msgid "User Guide"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:192
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:217
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:173
|
||||
msgid "FAQ"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:194
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:219
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:175
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:197
|
||||
msgid "Download Details"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Downloads_jsp.java:199
|
||||
msgid "Click on a download to view details"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:141
|
||||
msgid "Home"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:184
|
||||
msgid "Active Searches By Sender"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:186
|
||||
msgid "Group By File"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:190
|
||||
msgid "Active Searches By File"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:192
|
||||
msgid "Group By Sender"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/Home_jsp.java:222
|
||||
msgid "Results"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:137
|
||||
msgid "Welcome to MuWire! Please select a nickname and download locations"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:139
|
||||
msgid "Nickname"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:141
|
||||
msgid "Directory for saving downloaded files"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:145
|
||||
msgid "Directory for storing incomplete files"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/MuWire_jsp.java:149
|
||||
msgid "Submit"
|
||||
msgstr ""
|
||||
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:148
|
||||
#: build/tmp_jsp/com/muwire/webui/SharedFiles_jsp.java:150
|
||||
msgid "Share"
|
||||
msgstr ""
|
||||
|
||||
#: src/main/java/com/muwire/webui/MuWireServlet.java:57
|
||||
msgid "MuWire"
|
||||
msgstr ""
|
||||
|
||||
#: src/main/java/com/muwire/webui/MuWireServlet.java:68
|
||||
msgid "MuWire is initializing, please wait"
|
||||
msgstr ""
|
@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.router.RouterContext;
|
||||
import static com.muwire.webui.Util._t;
|
||||
|
||||
public class MuWireServlet extends HttpServlet {
|
||||
|
||||
@ -53,18 +54,18 @@ public class MuWireServlet extends HttpServlet {
|
||||
resp.setContentType("text/html");
|
||||
resp.setCharacterEncoding("UTF-8");
|
||||
resp.getWriter().println("<html><head>\n" +
|
||||
"<title>MuWire " + version + "</title>\n" +
|
||||
"<title>" + _t("MuWire") + ' ' + version + "</title>\n" +
|
||||
"<link href=\"i2pbote.css?" + version + "\" rel=\"stylesheet\" type=\"text/css\">\n" +
|
||||
"<link href=\"muwire.css?" + version + "\" rel=\"stylesheet\" type=\"text/css\">\n" +
|
||||
"</head><body>\n" +
|
||||
"<header class=\"titlebar\">" +
|
||||
"<div class=\"title\">" +
|
||||
"<img src=\"images/muwire.png\" alt=\"\">" +
|
||||
"Welcome to MuWire" +
|
||||
_t("Welcome to MuWire") +
|
||||
"</div>" +
|
||||
"<div class=\"subtitle\"><br><br><br><br></div>" +
|
||||
"<div class=\"pagetitle\">" +
|
||||
"MuWire is initializing, please wait" +
|
||||
_t("MuWire is initializing, please wait") +
|
||||
"</div>" +
|
||||
"</header>" +
|
||||
"</body></html>");
|
||||
|
@ -1,12 +1,18 @@
|
||||
package com.muwire.webui;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.util.Translate;
|
||||
|
||||
public class Util {
|
||||
|
||||
private static final I2PAppContext _context = I2PAppContext.getGlobalContext();
|
||||
|
||||
private static final String escapeChars[] = {"&", "\"", "<", ">", "'"};
|
||||
private static final String escapeCodes[] = {"&amp;", "&quot;", "&lt;", "&gt;", "&apos;"};
|
||||
|
||||
private static final String escapedCodes[] = {"&", """, "<", ">", "'"};
|
||||
|
||||
private static final String BUNDLE_NAME = "com.muwire.webui.messages";
|
||||
|
||||
/**
|
||||
* Double-Escape an HTML string for inclusion in XML
|
||||
* @param unescaped the unescaped string, may be null
|
||||
@ -29,4 +35,45 @@ public class Util {
|
||||
}
|
||||
return unescaped;
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
public static String _t(String s) {
|
||||
return Translate.getString(s, _context, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* translate a string with a parameter
|
||||
* This is a lot more expensive than _t(s), so use sparingly.
|
||||
*
|
||||
* @param s string to be translated containing {0}
|
||||
* The {0} will be replaced by the parameter.
|
||||
* Single quotes must be doubled, i.e. ' -> '' in the string.
|
||||
* @param o parameter, not translated.
|
||||
* To translate parameter also, use _t("foo {0} bar", _t("baz"))
|
||||
* Do not double the single quotes in the parameter.
|
||||
* Use autoboxing to call with ints, longs, floats, etc.
|
||||
*/
|
||||
public static String _t(String s, Object o) {
|
||||
return Translate.getString(s, o, _context, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/** two params @since 0.7.14 */
|
||||
public static String _t(String s, Object o, Object o2) {
|
||||
return Translate.getString(s, o, o2, _context, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/** translate (ngettext) @since 0.7.14 */
|
||||
public static String ngettext(String s, String p, int n) {
|
||||
return Translate.getString(n, s, p, _context, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a string for extraction by xgettext and translation.
|
||||
* Use this only in static initializers.
|
||||
* It does not translate!
|
||||
* @return s
|
||||
*/
|
||||
public static String _x(String s) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@include file="initcode.jsi"%>
|
||||
|
||||
<% String pagetitle="Downloads"; %>
|
||||
<% String pagetitle=Util._t("Downloads"); %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@ -22,7 +22,7 @@
|
||||
<aside>
|
||||
<%@include file="searchbox.jsi"%>
|
||||
<div class="menubox">
|
||||
<h2>Downloads</h2>
|
||||
<h2><%=Util._t("Downloads")%></h2>
|
||||
</div>
|
||||
<%@include file="sidebar.jsi"%>
|
||||
</aside>
|
||||
@ -31,8 +31,8 @@
|
||||
<div id="downloads"></div>
|
||||
</div>
|
||||
<hr/>
|
||||
<p>Download Details</p>
|
||||
<div id="downloadDetails"><p>Click on a download to view details</p></div>
|
||||
<p><%=Util._t("Download Details")%></p>
|
||||
<div id="downloadDetails"><p><%=Util._t("Click on a download to view details")%></p></div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@include file="initcode.jsi"%>
|
||||
<%
|
||||
String pagetitle="Home";
|
||||
String pagetitle=Util._t("Home");
|
||||
session.setAttribute("persona", persona);
|
||||
session.setAttribute("version", version);
|
||||
|
||||
@ -31,11 +31,11 @@
|
||||
<%@include file="searchbox.jsi"%>
|
||||
<div class="menubox">
|
||||
<% if (groupBy.equals("sender")) { %>
|
||||
<h2>Active Searches By Sender</h2>
|
||||
<a class="menuitem" href="Home.jsp?groupBy=file">Group By File</a>
|
||||
<h2><%=Util._t("Active Searches By Sender")%></h2>
|
||||
<a class="menuitem" href="Home.jsp?groupBy=file"><%=Util._t("Group By File")%></a>
|
||||
<% } else { %>
|
||||
<h2>Active Searches By File</h2>
|
||||
<a class="menuitem" href="Home.jsp?groupBy=sender">Group By Sender</a>
|
||||
<h2><%=Util._t("Active Searches By File")%></h2>
|
||||
<a class="menuitem" href="Home.jsp?groupBy=sender"><%=Util._t("Group By Sender")%></a>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
<%@include file="sidebar.jsi"%>
|
||||
</aside>
|
||||
<section class="main foldermain">
|
||||
<h3><span id="currentSearch">Results</span></h3>
|
||||
<h3><span id="currentSearch"><%=Util._t("Results")%></span></h3>
|
||||
<div id="table-wrapper">
|
||||
<div id="table-scroll">
|
||||
<div id="topTable"></div>
|
||||
|
@ -17,14 +17,14 @@
|
||||
session.setAttribute("defaultIncompletesLocation",defaultIncompletesLocation);
|
||||
%>
|
||||
|
||||
<p>Welcome to MuWire! Please select a nickname and download locations</p>
|
||||
<p><%=Util._t("Welcome to MuWire! Please select a nickname and download locations")%></p>
|
||||
<form action="/MuWire/init.jsp" method="post">
|
||||
Nickname:
|
||||
<%=Util._t("Nickname")%>:
|
||||
<input type="text" name="nickname"><br>
|
||||
Directory for saving downloaded files:
|
||||
<%=Util._t("Directory for saving downloaded files")%>:
|
||||
<input type='text' name='download_location' value="${defaultDownloadLocation}"><br/>
|
||||
Directory for storing incomplete files:
|
||||
<%=Util._t("Directory for storing incomplete files")%>:
|
||||
<input type='text' name='incomplete_location' value="${defaultIncompletesLocation}"><br/>
|
||||
<input type="submit" value="Submit">
|
||||
<input type="submit" value="<%=Util._t("Submit")%>">
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<header class="titlebar">
|
||||
<div class="title">
|
||||
<a href="Home.jsp"><img src="images/muwire.png" alt=""></a>
|
||||
<br>Welcome to MuWire
|
||||
<br><%=Util._t("Welcome to MuWire")%>
|
||||
</div>
|
||||
<div class="subtitle">
|
||||
<br>
|
||||
|
@ -1,11 +1,11 @@
|
||||
<div class="menubox-divider"></div>
|
||||
<div class="menubox">
|
||||
<div class="searchbox">
|
||||
<h2>Search</h2>
|
||||
<h2><%=Util._t("Search")%></h2>
|
||||
<div class="menu-icon"></div>
|
||||
<form action="/MuWire/Search" method="post">
|
||||
<input type="text" name="search" />
|
||||
<input type="submit" value="Search" />
|
||||
<input type="submit" value="<%=Util._t("Search")%>" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user