Hi,
2009/3/30 Mike <[email protected]>
> 在 2009-03-30一的 15:47 +0800,Jimmy,Jing Lv写道:
>
> > Yes if the programmers does have sense to make their projects localizable
> > (like Apache Harmony) that'll be good, the only work left for the tool is
> to
> > translate and fulfill the property file, however many of them does not.
> The
> > project will help them to do that.
> > Yep, that's an alternative implementation, however this requires the
> > re-compilation thus is not flexible, and may have problems on
> deployment(jar
> > replacement is costly!). If we use a property/resource Bundle mechanism,
> no
> > compilation nor source code modification is need if we want to add one or
> > more languages.
> >
>
> well, it sounds that we needs to scan all the Strings in the source
> code?
Yes, possible, or at least one choice :)
>
>
> For property/resource implement, it's not easy let the program itself
> know. That is to say, you can't control it when displaying the String.
> You have to translate it out when the String is created, So if we want
> to all-in-one jar translation solution, we need a hack on the String
> class. Which i don't think is clean. ^_^
For the first thing, hack on the Harmony String is CLEAN, Apache Harmony has
fully implemented the JRE, jvm plus classlib :)
However, hack on the String is one of the choices. On the other hand, for an
example, we may have a line of:
throw new RuntimeException("Love");
and after our injection, this line will become something like
throw new RuntimeException(Messagers.get("Love",thisLocal));
where "Messagers.get("Love",thisLocal)" will return some translated words
for the local, e.g, "Amour" in the language of Franch, or "Liebe" in German
;)
Further more, we may ignore some hard-to-analysis words/sentences but only
focus on the ones which are easy to apply the localization? :)
All kinds of ideas on design is welcome at this period. Please tell me if
you have more questions :)
> But of course, if we implemented in that way, harmony's j2se class
> library implementation might be popular.^_^
>
> Thanks for you reply,
>
> Yours, Mike
>
>
>
--
Best Regards!
Jimmy, Jing Lv
China Software Development Lab, IBM