source: apps/routerconsole/java/bundle-messages.sh @ 0c74e64

Last change on this file since 0c74e64 was 0c74e64, checked in by zzz <zzz@…>, 11 years ago
  • Console:
    • Don't hide link to configui.jsp for IE any more
    • Add lang selection on configui.jsp
    • Tag strings in configui.jsp
    • Load console_big.css if lang == zh
    • Add _x() tag for static iniitializers
    • HTML transitional input tags
  • Property mode set to 100755
File size: 1.8 KB
Line 
1#
2# Update messages_xx.po and messages_xx.class files,
3# from both java and jsp sources.
4# Requires installed programs xgettext, msgfmt, msgmerge, and find.
5# zzz - public domain
6#
7CLASS=net.i2p.router.web.messages
8TMPFILE=build/javafiles.txt
9export TZ=UTC
10
11for i in ../locale/messages_*.po
12do
13        # get language
14        LG=${i#../locale/messages_}
15        LG=${LG%.po}
16
17        # make list of java files newer than the .po file
18        find src ../jsp/WEB-INF -name *.java -newer $i > $TMPFILE
19        if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a ! -s $TMPFILE ]
20        then
21                continue
22        fi
23
24        echo "Generating ${CLASS}_$LG ResourceBundle..."
25
26        # extract strings from java and jsp files, and update messages.po files
27        # translate calls must be one of the forms:
28        # _("foo")
29        # _x("foo")
30        # cssHelper._("foo")
31        # cssHelper.title("foo")
32        # handler._("foo")
33        # formhandler._("foo")
34        # In a jsp, you must use a helper or handler that has the context set.
35        # To start a new translation, copy the header from an old translation to the new .po file,
36        # then ant distclean updater.
37        find src ../jsp/WEB-INF -name *.java > $TMPFILE
38        xgettext -f $TMPFILE -F -L java \
39                 --keyword=_ --keyword=_x --keyword=cssHelper._ --keyword=cssHelper.title \
40                 --keyword=handler._ --keyword=formhandler._ \
41                 -o ${i}t
42        if [ $? -ne 0 ]
43        then
44                echo 'Warning - xgettext failed, not updating translations'
45                rm -f ${i}t
46                break
47        fi
48        msgmerge -U --backup=none $i ${i}t
49        if [ $? -ne 0 ]
50        then
51                echo 'Warning - msgmerge failed, not updating translations'
52                rm -f ${i}t
53                break
54        fi
55        rm -f ${i}t
56        # so we don't do this again
57        touch $i
58
59        # convert to class files in build/obj
60        msgfmt --java -r $CLASS -l $LG -d build/obj $i
61        if [ $? -ne 0 ]
62        then
63                echo 'Warning - xgettext failed, not updating translations'
64                break
65        fi
66done
67rm -f $TMPFILE
68# todo: return failure
69exit 0
Note: See TracBrowser for help on using the repository browser.