Change build target to Java 8

Change translation tag from deprecated _ to _t
Add support for faster translation bundle generation
Change bundle format from java to java2
This commit is contained in:
zzz
2022-01-01 09:31:42 -05:00
parent c1e1569681
commit 9fc4c2b821
17 changed files with 192 additions and 161 deletions

View File

@ -71,9 +71,7 @@ do
# then ant distclean updater.
find $JPATHS -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java --from-code=UTF-8 --add-comments\
--keyword=_ --keyword='_:1,2,3c' --keyword=_x --keyword=intl._ --keyword=intl.title \
--keyword=handler._ --keyword=formhandler._ \
--keyword=net.i2p.router.web.Messages.getString \
--keyword=_t \
-o ${i}t
if [ $? -ne 0 ]
then
@ -100,15 +98,40 @@ do
# only generate for non-source language
echo "Generating ${CLASS}_$LG ResourceBundle..."
# convert to class files in build
msgfmt --java --statistics -r $CLASS -l $LG -d build $i
msgfmt -V | grep -q -E ' 0\.((19)|[2-9])'
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 -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
# slow way
# convert to class files in build
msgfmt --java2 --statistics -r $CLASS -l $LG -d build $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 -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/net/i2p/itoopie
TD2=build/messages-src
TDY=$TD2/net/i2p/itoopie
rm -rf $TD
mkdir -p $TD $TDY
msgfmt --java2 --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 build/obj -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
fi
mv $TDX/messages_$LG.java $TDY
rm -rf $TD
fi
fi
done