Changeset d8389dc


Ignore:
Timestamp:
Nov 12, 2009 2:07:15 PM (11 years ago)
Author:
walking <walking@…>
Branches:
master
Children:
d6814a0
Parents:
9f93955
Message:

stop duplicating, use "source bundle-messages.sh"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/bmsg.sh

    r9f93955 rd8389dc  
    1515## walking - public domain :-D
    1616
    17 
    18 CLASS=net.i2p.router.web.messages
    19 TMPFILE=build/javafiles.txt
    20 export TZ=UTC
    21 
    22 #
    23 # generate strings/Countries.java from ../../../installer/resources/countries.txt
    24 #
    25 CFILE=../../../installer/resources/countries.txt
    26 JFILE=build/Countries.java
    27 if [ $CFILE -nt $JFILE -o ! -s $JFILE ]
    28 then
    29         mkdir -p build
    30         echo '// Automatically generated pseudo-java for xgettext - do not edit' > $JFILE
    31         echo '// Translators may wish to translate a few of these, do not bother to translate all of them!!' >> $JFILE
    32         sed 's/..,\(..*\)/_("\1");/' $CFILE >> $JFILE
    33 fi
    34 
    35 # list specific files in router/ here, so we don't scan the whole tree
    36 ROUTERFILES="\
    37    ../../../router/java/src/net/i2p/router/RouterThrottleImpl.java \
    38    ../../../router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java \
    39    ../../../router/java/src/net/i2p/router/transport/TransportManager.java \
    40    ../../../router/java/src/net/i2p/router/transport/GetBidsJob.java \
    41    ../../../router/java/src/net/i2p/router/Blocklist.java \
    42    ../../../router/java/src/net/i2p/router/transport/ntcp/EstablishState.java"
    43 for i in ../locale/messages_*.po
    44 do
    45         # get language
    46         LG=${i#../locale/messages_}
    47         LG=${LG%.po}
    48 
    49         # make list of java files newer than the .po file
    50         find $JPATHS -name *.java -newer $i > $TMPFILE
    51         if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a \
    52              build/obj/net/i2p/router/web/messages_$LG.class -nt $i -a \
    53              ! -s $TMPFILE ]
    54         then
    55                 continue
    56         fi
    57 
    58         echo "Generating ${CLASS}_$LG ResourceBundle..."
    59 
    60         # extract strings from java and jsp files, and update messages.po files
    61         # translate calls must be one of the forms:
    62         # _("foo")
    63         # _x("foo")
    64         # intl._("foo")
    65         # intl.title("foo")
    66         # handler._("foo")
    67         # formhandler._("foo")
    68         # net.i2p.router.web.Messages.getString("foo")
    69         # In a jsp, you must use a helper or handler that has the context set.
    70         # To start a new translation, copy the header from an old translation to the new .po file,
    71         # then ant distclean updater.
    72         find $JPATHS -name *.java > $TMPFILE
    73         xgettext -f $TMPFILE -F -L java --from-code=UTF-8 \
    74                  --keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \
    75                  --keyword=handler._ --keyword=formhandler._ \
    76                  --keyword=net.i2p.router.web.Messages.getString \
    77                  -o ${i}t
    78         if [ $? -ne 0 ]
    79         then
    80                 echo 'Warning - xgettext failed, not updating translations'
    81                 rm -f ${i}t
    82                 break
    83         fi
    84         msgmerge -U --backup=none $i ${i}t
    85         if [ $? -ne 0 ]
    86         then
    87                 echo 'Warning - msgmerge failed, not updating translations'
    88                 rm -f ${i}t
    89                 break
    90         fi
    91         rm -f ${i}t
    92         # so we don't do this again
    93         touch $i
    94 
    95         # convert to class files in build/obj
    96         msgfmt --java -r $CLASS -l $LG -d build/obj $i
    97         if [ $? -ne 0 ]
    98         then
    99                 echo 'Warning - msgfmt failed, not updating translations'
    100                 break
    101         fi
    102 done
    103 rm -f $TMPFILE
    104 # todo: return failure
    105 exit 0
     17source bundle-messages.sh
Note: See TracChangeset for help on using the changeset viewer.