Hi Klas,
Klas Eriksson wrote:
Hi
Does anyone have any experience in localizing jsp
pages? To have jsp-pages in 4 different languages for
example.
It's no fun to maintain 4 versions.
It's no fun to translate pages in runtime.
Is there a way do to compile time processing?
One idea could be to:
* at jsp-compile time get phrases/words from a database...
Or is there a tool that can pre-process pages and
from jsp-"templates" generate one jsp-page for each language?
/Klas
We've done exactly as you've proposed, by pre-processing "language-neutral"
JSP files into language-specific ones. We do this by marking translatable
sections in the JSP (or indeed static HTML) files using <PHRASE>...</PHRASE>
tags and then running a homemade utility over them. I'm not aware if there
are any standard tools available to do this kind of thing, but I would also
be glad to know of their existence.
A more straightforward approach would probably use Java resource bundles
etc., but our tool uses a translation database. This because we have to
share this database with C++ and Cobol applications that predate Java in our
organisation, and because we can easily provide interactive screens to
maintain the data.
Athough we have not yet gone fully into production with this scheme, we have
found that it generally works well. The advantages are as follows:
1. There is minimal run-time overhead for translation because it's mostly
done offline (except 4, 7 and 8).
2. We can see beforehand what the JSP/HTML files will look like when
translated (except 9)
3. We can easily exclude certain JSP/HTML files from the automation should
we want to hand-translate them
4. We can play some tricks with the 404 not found handling in Apache to
achieve on-the-fly translation
5. We could use tag libraries in future.
As always, our experience has also shown us the limitations of the approach:
6. The use of special markup is a risk, but we can perhaps mitigate this by
using a tag-library naming style.
7. It simplistic to assume that a non-trivial application can get by without
run-time translations - for example the contents of list boxes. Our
translation system therefore makes a run-time library available.
8. Exception handling. This is another dynamic translation scenario (see 7).
It is also a formatting problem: how to fold multiple arguments into
internationalised messages. We use the Java message formatting methods.
9. Browsers ignore the <PHRASE>...</PHRASE> markup in free HTML, but not in
Form controls so these look somewhat messy in their language-neutral state.
10. Graphics are much more difficult to support. The best solution is to
make the graphics symbolic if possible, rather than language-dependent.
Theoretically it might be feasible to generate translated graphics
on-the-fly using a toolkit such as GIMP but we haven't dared to try it.
Our system tends to be used almost exclusively in one language at any one
site (it's intranet-based), and therefore not many more servlets are
involved than would be if it were uni-lingual. If you were to have many
languages simultaneously active, this could obviously involve a lot more
servlets and corresponding resources, but then you could always do the
translation dynamically from a cache.
In my opinion JSP suits this approach to localisation, but you should
provide good management control:
* Have a stable development environment (it's taken us over 4 months to
achieve the desired maturity)
* Have well-defined standards for translatable elements (we will have up to
10 000)
* Monitor the JSPs carefully. Observe usage. Identify patterns. Keep JSP
files compact. Don't pack the business logic into JSPs - place the logic in
explicit class files instead.
Hope this helps,
Geoff Lewis
Finatec Financial Software Solutions AG
Tel: +49 9371 97860
Web: http://www.finatec.de
Email: [EMAIL PROTECTED]
begin 600 winmail.dat
M>)\^(B<6`0:0"``$```````!``$``0>0!@`(````Y`0```````#H``$(@`<`
M&````$E032Y-:6-R;W-O9G0@36%I;"Y.;W1E`#$(`06``P`.````SP<*`!L`
M```E`"4``P!(`0$@@`,`#@```,\'"@`;````)0`E``,`2`$!"8`!`"$```!#
M-S8R-C(U-4(T.$%$,S$Q.4%&-C`P,3`U03,Y,48T.0#Y!@$$@`$`+P```%)%
M.B!,;V-A;&EZ960@8V]N=&5N="P@8V]M<&EL92!T:6UE(&]P97)A=&EO;G,`
M"Q$!#8`$``(````"``(``0.0!@"P#P``*P````L``@`!`````P`N``````!`
M`#D`L$PEM`(@OP$>`'```0```"L```!,;V-A;&EZ960@8V]N=&5N="P@8V]M
M<&EL92!T:6UE(&]P97)A=&EO;G,```(!<0`!````&P````&_'^"7M_"$)$^(
M9Q'3G&``$$M%WXL`!4<*(``>`#%``0````<```!'14]&1DP```,`&D``````
M'@`P0`$````'````1T5/1D9,```#`!E```````(!"1`!````)@L``"(+``!:
M$P``3%I&=98;HS<#``H`<F-P9S$R-=(R`/LS-@'H(`*D`^,)`@!C:`K`<V5T
M,/X@!Q,"@P!0`]41:`Y0`O*Q$+E486@#<0*`?0J`V0C((#L);PXP-0*`"H%\
M=6,`4`L##-`!P0S!,60T-!@2,C$/0!B2.$XX&!(/,1@2-#,8`S62,!AS-3<8
MXS8T&5-K`<$;DSD8`S@;[EMAIL PROTECTED]\/,1@B&<`94QV0&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J>7_BW:0P-V@`?(SP=C"XT9"IOU#,$@Q$VO"::+P
MP/TA8G#O&H/4((N@8F!N&H/_=(3POZ-PN0-Q0S5PZ7`V`&B-$_^Q%HWSS?!Y
M@-IB/(!^T'$!_Z4U&[:5\O!A*>`PT&NS=!/?-K-I#)8`&G.]D"BJ4J+";S$#
MO5$Y859@(%P!(@A-_RRP<0";`FJT"C%RD9$3RY'^8@*BO`(SP7'1\,(UH&,!
M]]8QV:'+@4N,X+U@94A#PO]A46>0,$#X@K"!HS!JHG<0]T"Q2=*7X&?N(F7R
M*0/)$/]+T3(1N5,O-;=RAL&4P:;0W\0A97=YX7"`-]M(8G"$974^<&R_,"PW
MZE!$$[,R/5_P<UM@Z$#Q0.G@($SWY/#+`$*T1G8P/(%G,#?RZWH0Q8)3RL!T
M<H,Y$.O4:;V004="M%26`-<0*T0T.:40,S<QI1`W^U6`8!=BUQ!?LT(0D[#=
M`-AP.B]%0#V0+B-A."+>+O#`$Z-"$&`518UA.N';QL"=@2[6X#=A0#W60\&O
M7[8VD%>13_-]4"``0I```!X`0A`!````(````#PS.#$U1#$P-"XT0S$R0S4X
M0D!W96)G:7)O+F-O;3X`"P`$@`@@!@``````P````````$8``````X4`````
M```#``"`""`&``````#`````````1@`````0A0````````,``X`((`8`````
M`,````````!&`````%*%``#S%0``'@`%@`@@!@``````P````````$8`````
M5(4```$````%````."XP-``````#``:`""`&``````#`````````1@`````!
MA0````````L`!X`((`8``````,````````!&``````Z%`````````P`(@`@@
M!@``````P````````$8`````$84````````#``F`""`&``````#`````````
M1@`````8A0```````!X`"H`((`8``````,````````!&`````#:%```!````
M`0`````````>``N`""`&``````#`````````1@`````WA0```0````$`````
M````'@`,@`@@!@``````P````````$8`````.(4```$````!``````````,`
M\3\)!````P#]/^0$```#`"8```````,`-@```````P"`$/____\"`4<``0``
M`#````!C/41%.V$](#MP/49)3D%414,[;#U35$%21T%412TY.3$P,C8R,C,W
M,S=:+34U,@`>`#A``0````<```!'14]&1DP``!X`.4`!````!P```$=%3T9&
M3```0``',)!5);0"(+\!0``(,!`"2K0"(+\!'@`]``$````%````4D4Z(```
M```>`!T.`0```"L```!,;V-A;&EZ960@8V]N=&5N="P@8V]M<&EL92!T:6UE
M(&]P97)A=&EO;G,``!X`-1`!````,@```#PX,3,U0T,S,$-$1$1$,3$Q.4)#
M.3`P,3`T0C0U1$8X0C$Y-C0W14!35$%21T%413X````+`"D```````L`(P``
M`````P`&$!K$JIT#``<06@P```,`$!```````P`1$``````>``@0`0```&4`
M``!(24M,05,L2TQ!4T5224M34T].5U)/5$4Z2$E$3T5304Y93TY%2$%614%.
M64584$52245.0T5)3DQ/0T%,25I)3D=*4U!004=%4S]43TA!5D5*4U`M4$%'
M15-)3C1$249&15)%``````(!?P`!````,@```#PX,3,U0T,S,$-$1$1$,3$Q
E.4)#.3`P,3`T0C0U1$8X0C$Y-C0W14!35$%21T%413X````U,0==
`
end
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html