Moving all localized strings into one Bundle
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 12 Sep 2009 09:11:13 +0200
changeset 80e03f660f0e0a
parent 79 89bca098e14e
child 81 1174c9dcab41
Moving all localized strings into one Bundle
freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game_cs.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index_cs.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login_cs.properties
     1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Sat Sep 12 05:00:28 2009 +0200
     1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Sat Sep 12 09:11:13 2009 +0200
     1.3 @@ -248,18 +248,16 @@
     1.4      }
     1.5  
     1.6      private Viewable viewable(String page, Document doc, Object... more) {
     1.7 -        String bundle = page.split("\\.")[0];
     1.8 -
     1.9          ResourceBundle rb = null;
    1.10          for (Locale l : headers.getAcceptableLanguages()) {
    1.11              try {
    1.12 -                rb = ResourceBundle.getBundle("cz.xelfi.quoridor.freemarkerdor.UI." + bundle, l);
    1.13 +                rb = ResourceBundle.getBundle("cz.xelfi.quoridor.freemarkerdor.UI.Bundle", l);
    1.14              } catch (MissingResourceException e) {
    1.15                  // OK
    1.16              }
    1.17          }
    1.18          if (rb == null) {
    1.19 -            rb = ResourceBundle.getBundle("cz.xelfi.quoridor.freemarkerdor.UI." + bundle, Locale.ENGLISH);
    1.20 +            rb = ResourceBundle.getBundle("cz.xelfi.quoridor.freemarkerdor.UI.Bundle", Locale.ENGLISH);
    1.21          }
    1.22  
    1.23          Map<String,Object> map = new HashMap<String,Object>();
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties	Sat Sep 12 09:11:13 2009 +0200
     2.3 @@ -0,0 +1,43 @@
     2.4 +TITLE=<a href="http://en.wikipedia.org/wiki/Quoridor">Quoridor</a> Community Server
     2.5 +
     2.6 +
     2.7 +gameWhiteBlack={0} vs. {1}
     2.8 +LastMove=Last move {1,choice,\
     2.9 +  0#second|\
    2.10 +  2#{1} seconds|\
    2.11 +  60#a minute|\
    2.12 +  120#{2} minutes|\
    2.13 +  3600#an hour|\
    2.14 +  7200#{3} hours|\
    2.15 +  86400#a day|\
    2.16 +  172800#{4} days\
    2.17 +} ago
    2.18 +GAME_MOVE=Your move
    2.19 +GAME_WAIT=Opponent's move
    2.20 +GAME_WON=Won games
    2.21 +GAME_LOST=Lost games
    2.22 +CREATE=Create!
    2.23 +GAME_ALL=All games
    2.24 +WHITE=White
    2.25 +BLACK=Black
    2.26 +
    2.27 +players={0} vs. {1}
    2.28 +PLACE=Place!
    2.29 +MOVE=Move!
    2.30 +RESIGN=Resign!
    2.31 +H=Horizontal
    2.32 +V=Vertical
    2.33 +RELOAD=Reload
    2.34 +GAME=Game
    2.35 +MOVENUMBER=#
    2.36 +MOVES=Moves
    2.37 +ROOT=Home
    2.38 +MOVE_WHO=It is {0}\'s turn.
    2.39 +WON={0} won
    2.40 +
    2.41 +
    2.42 +NAME=Name
    2.43 +PASSWORD=Password
    2.44 +LOGIN=Login!
    2.45 +logged=You are logged in as {0}.
    2.46 +home=Start!
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties	Sat Sep 12 09:11:13 2009 +0200
     3.3 @@ -0,0 +1,49 @@
     3.4 +TITLE=Komunitn\u00ED server <a href="http://cs.wikipedia.org/wiki/Quoridor">Quoridor</a>
     3.5 +gameWhiteBlack={0} proti {1}
     3.6 +GAME_MOVE=Na tahu
     3.7 +GAME_WAIT=\u010Cek\u00E1 se na tah
     3.8 +GAME_WON=Vyhran\u00E9
     3.9 +GAME_LOST=Prohran\u00E9
    3.10 +CREATE=Vytvo\u0159 novou
    3.11 +GAME_ALL=V\u0161echny hry
    3.12 +WHITE=B\u00EDl\u00FD
    3.13 +BLACK=\u010Cern\u00FD
    3.14 +LastMove=T\u00E1hnuto p\u0159ed {1,choice,\
    3.15 +  0#chv\u00EDl\u00ED|\
    3.16 +  10#{1}-ti sekundami|\
    3.17 +  60#minutou|\
    3.18 +  120#dv\u011Bma minutami|\
    3.19 +  180#t\u0159emi minutami|\
    3.20 +  240#\u010Dty\u0159mi minutami|\
    3.21 +  300#{2}-ti minutami|\
    3.22 +  3600#hodinou|\
    3.23 +  7200#dv\u011Bma hodinami|\
    3.24 +  10800#t\u0159emi hodinami|\
    3.25 +  14400#\u010Dty\u0159mi hodinami|\
    3.26 +  18000#{3}-ti hodinami|\
    3.27 +  86400#jedn\u00EDm dnem|\
    3.28 +  172800#dv\u011Bma dny|\
    3.29 +  259200#t\u0159emi dny|\
    3.30 +  345600#\u010Dty\u0159mi dny|\
    3.31 +  432000#{4}-ti dny\
    3.32 +}
    3.33 +
    3.34 +players={0} proti {1}
    3.35 +PLACE=Um\u00EDstit
    3.36 +MOVE=T\u00E1hnout
    3.37 +RESIGN=Vzd\u00E1t
    3.38 +H=Horizont\u00E1ln\u011B
    3.39 +V=Vertik\u00E1ln\u011B
    3.40 +RELOAD=Obnovit
    3.41 +GAME=Hra
    3.42 +MOVENUMBER=Tah
    3.43 +MOVES=Z\u00E1pis
    3.44 +ROOT=Dom\u016F
    3.45 +MOVE_WHO=Na tahu je {0}
    3.46 +WON=Vyhr\u00E1l {0}
    3.47 +TITLE=Komunitn\u00ED server Quoridor
    3.48 +NAME=Jm\u00E9no
    3.49 +PASSWORD=Heslo
    3.50 +LOGIN=P\u0159ihl\u00E1sit se
    3.51 +logged=Jste p\u0159ihl\u00E1\u0161en jako {0}
    3.52 +home=Za\u010D\u00EDt hr\u00E1t
     4.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.properties	Sat Sep 12 05:00:28 2009 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,13 +0,0 @@
     4.4 -players={0} vs. {1}
     4.5 -PLACE=Place!
     4.6 -MOVE=Move!
     4.7 -RESIGN=Resign!
     4.8 -H=Horizontal
     4.9 -V=Vertical
    4.10 -RELOAD=Reload
    4.11 -GAME=Game
    4.12 -MOVENUMBER=#
    4.13 -MOVES=Moves
    4.14 -ROOT=Home
    4.15 -MOVE_WHO=It is {0}'s turn.
    4.16 -WON={0} won
     5.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game_cs.properties	Sat Sep 12 05:00:28 2009 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,13 +0,0 @@
     5.4 -players={0} proti {1}
     5.5 -PLACE=Um\u00EDstit
     5.6 -MOVE=T\u00E1hnout
     5.7 -RESIGN=Vzd\u00E1t
     5.8 -H=Horizont\u00E1ln\u011B
     5.9 -V=Vertik\u00E1ln\u011B
    5.10 -RELOAD=Obnovit
    5.11 -GAME=Hra
    5.12 -MOVENUMBER=Tah
    5.13 -MOVES=Z\u00E1pis
    5.14 -ROOT=Dom\u016F
    5.15 -MOVE_WHO=Na tahu je {0}
    5.16 -WON=Vyhr\u00E1l {0}
     6.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt	Sat Sep 12 05:00:28 2009 +0200
     6.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt	Sat Sep 12 09:11:13 2009 +0200
     6.3 @@ -7,26 +7,18 @@
     6.4    <body>
     6.5        <h1>${bundle.TITLE}</h1>
     6.6  
     6.7 -      <#macro past t>
     6.8 -        <#if t < 60000>
     6.9 -          <#assign unit="s"/>
    6.10 -          <#assign value= t?float / 1000.0/>
    6.11 -        <#elseif t < 3600000>
    6.12 -          <#assign unit="min"/>
    6.13 -          <#assign value=t?float / 60000.0/>
    6.14 -        <#elseif t < 24 * 3600 * 1000>
    6.15 -          <#assign unit="h"/>
    6.16 -          <#assign value=t?float / 3600000.0/>
    6.17 -        <#else>
    6.18 -          <#assign unit="day"/>
    6.19 -          <#assign value=t?float / (24.0 * 3600000.0)/>
    6.20 -        </#if>
    6.21 -        <!--millis ${t}-->${value?float?string("0")} ${unit}
    6.22 +      <#macro before t>
    6.23 +        <#assign seconds = (t / 1000)?int/>
    6.24 +        <#assign minutes= (seconds / 60)?int/>
    6.25 +        <#assign hours= (minutes / 60)?int/>
    6.26 +        <#assign days= (hours / 24)?int/>
    6.27 +        <!--millis: ${t}, seconds: ${seconds}, minutes: ${minutes} hours: ${hours}, days: ${days} -->
    6.28 +        ${bundle("LastMove", t?int, seconds?int, minutes?int, hours?int, days?int)}
    6.29        </#macro>
    6.30  
    6.31        <#macro game game>
    6.32            ${bundle("gameWhiteBlack", game.@white?string, game.@black?string)} 
    6.33 -          <a href="/games/${game.@id}/">${bundle.before} <@past (now - game.@modified?number)/></a>
    6.34 +          <a href="/games/${game.@id}/"><@before (now - game.@modified?number)?int/></a>
    6.35        </#macro>
    6.36  
    6.37        <#if message?? >
     7.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.properties	Sat Sep 12 05:00:28 2009 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,13 +0,0 @@
     7.4 -TITLE=<a href="http://en.wikipedia.org/wiki/Quoridor">Quoridor</a> Community Server
     7.5 -gameWhiteBlack={0} vs. {1}
     7.6 -BOARD=QuoBoard
     7.7 -GAME_MOVE=Your move
     7.8 -GAME_WAIT=Opponent's move
     7.9 -GAME_WON=Won games
    7.10 -GAME_LOST=Lost games
    7.11 -CREATE=Create!
    7.12 -GAME_ALL=All games
    7.13 -WHITE=White
    7.14 -BLACK=Black
    7.15 -before=Before
    7.16 -
     8.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index_cs.properties	Sat Sep 12 05:00:28 2009 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,13 +0,0 @@
     8.4 -TITLE=Komunitn\u00ED server <a href="http://cs.wikipedia.org/wiki/Quoridor">Quoridor</a>
     8.5 -gameWhiteBlack={0} proti {1}
     8.6 -BOARD=Hrac\u00ED deska
     8.7 -GAME_MOVE=Na tahu
     8.8 -GAME_WAIT=\u010Cek\u00E1 se na tah
     8.9 -GAME_WON=Vyhran\u00E9
    8.10 -GAME_LOST=Prohran\u00E9
    8.11 -CREATE=Vytvo\u0159 novou
    8.12 -GAME_ALL=V\u0161echny hry
    8.13 -WHITE=B\u00EDl\u00FD
    8.14 -BLACK=\u010Cern\u00FD
    8.15 -before=P\u0159ed
    8.16 -
     9.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login.properties	Sat Sep 12 05:00:28 2009 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,6 +0,0 @@
     9.4 -TITLE=Quoridor Community Server
     9.5 -NAME=Name
     9.6 -PASSWORD=Password
     9.7 -LOGIN=Login!
     9.8 -logged=You are logged as {0}.
     9.9 -home=Start!
    10.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login_cs.properties	Sat Sep 12 05:00:28 2009 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,6 +0,0 @@
    10.4 -TITLE=Komunitn\u00ED server Quoridor
    10.5 -NAME=Jm\u00E9no
    10.6 -PASSWORD=Heslo
    10.7 -LOGIN=P\u0159ihl\u00E1sit se
    10.8 -logged=Jste p\u0159ihl\u00E1\u0161en jako {0}
    10.9 -home=Za\u010D\u00EDt hr\u00E1t