[jsword-devel] I18N (was: New Developer)

Aleksander Rozman - Andy jsword-devel@crosswire.org
Sat, 27 Dec 2003 23:12:21 +0100


At 12/27/2003, you wrote:
Hi Joe !


>JSword used to use a method very similar to yours, and I found that the 
>message file was constantly getting out of date with respect to the source.
>There were 3 problems:
>- editing properties files was a hassle
>- unused messages would not be purged
>- lazy developers (me!) would add an i18n key thinking "i'll add it to the 
>message file later" and never do it.

Reason why we have so many bad programs arround are sloppy developers.... I 
mean java has so many solutions for one single problem, that is sometimes 
very hard to see the light. If you are sloppy OK, we will add Exception 
thrower into class that reads I18N Strings, so that you won't be able to 
run program, while you don't fix properties file.

>The Msg system solves these problems by making the I18N type-safe - 
>Exceptions take a Msg and not a String and so on.

Maybe it is. But did you take a look how long this code takes to run? Each 
'new' command creates new instance of class. Now I am looking at one of 
your Msg classes \jsowrd\book\basic\Msg... You have called 'new' 10 times, 
you have created 10 instances of Msg, whichh are showed as static varaibles 
(whose usage is really not recomneded in java), all of this 10 Msg extend 
MsgBase, so you have created another 10 instances of MsgBase (you can 
access them directkly since Msg class extends this class), so this class 
has 20 instances of classes created. Resourcebundle is static, but this 
doesn't mean anything beacuse when you call init you always create new 
instance of ResourceBundle (you can't access old versions, because you set 
new version to old handle...

>You can now navigate to the message with a single key press in any decent 
>IDE (in eclipse I just press F3)
>You can detect if the message is used without lengthy search procedures 
>with your IDE (ctrl+shift+g in eclipse)
>The english developer can ignore message files completely because the 
>messages are in the source

Only good thing about Msg/MsgBase shema is that is easy for sloppy 
programers...


>JSword can sill be internationalized simply by adding message files
>
>To clear up some of the points you made:
>Does this scheme waste space?

Quite a lot. Each Msg file creates new object, with MsgBase as parent, and 
again as Enum as parent. We are losing a lot of time, and we use a lot of 
memory.


>We use extra static space for a few objects that wrap strings. Only one 
>copy of MsgBase is needed, and the strings themselves (the things that 
>take up the real space) would exist anyway.

Static really shouldn't be used, at least not for I18N. Unfortunately you 
have a lot of MsgBase copies and a lot of Enum copies and a lot of Msgs. 
When you call super(something), this is like 'new', which means we have a 
lot of instances... If you would want to have just one instance you would 
have to do it like I did. You call constructor once, and just once. Every 
time you call constructor you make new instance (every time you call 
new)... Problem in java is that we can't control Garabage Collector so we 
could kill old instances. GC is run when we run out of memory (but this is 
not good thing), since sometime some memory can't be cleaned...


>So yes this does waste some space, but I think that is a reasonable price 
>to pay.

Resonable price to be sloppy? Don't think so... Java can be a great 
programing language, but if you are sloppy, you make a lot of users wish 
you would use some other programing language...

Andy



>_______________________________________________
>jsword-devel mailing list
>jsword-devel@crosswire.org
>http://www.crosswire.org/mailman/listinfo/jsword-devel

**************************************************************************
*  Aleksander Rozman - Andy  * Fandoms:  E2:EA, SAABer, Trekkie, Earthie *
*     andy@kksonline.com     * Sentinel, BH 90210, True's Trooper,       *
*    andy@atechnet.dhs.org   * Heller's Angel, Questie, Legacy, PO5,     *
* Maribor, Slovenia (Europe) * Profiler, Buffy (Slayerete), Pretender    *
*     ICQ-UIC: 4911125       *********************************************
*     PGP key available      *    http://www.atechnet.dhs.org/~andy/     *
**************************************************************************