[jsword-devel] Externalizing Strings

Joe Walker jsword-devel@crosswire.org
Tue, 06 Apr 2004 18:15:52 +0100


I think this patch looks good.
My one question is - we are introducing eclipse specific annotations 
into the code. Now this doesn't prevent anyone from using another IDE to 
compile our code. But it might prevent someone from using the i18n 
features of another IDE.

I'm fairly sure JBuilder Foundation doesn't do it, but the payware 
versions do because there is a greyed out menu item in my copy of 
foundation. From looking at the help it doesn't look like you get the 
same "ignore this one" functionality. I seem to remember VisualCafe 
having a similar thing. But VC is dead now.

Can anyone comment on how NetBeans or Idea handle i18n of strings? I 
don't think Together does this at all. Anyone know about other IDEs

If there is a standard that everyone else uses then I might be tempted 
to think again, but assuming there isn't (which I would guess is a safe 
assumption) we should carry on with this method.

Joe.


DM Smith wrote:
> I  have attached a patch for evaluation. I don't mean for it to be 
> checked in unless there is general agreement that this is an approach we 
> want to pursue.
> 
> Eclipse has decent support for externalizing strings.
> 
> With developer cooperation, it also can help by flagging strings that 
> need to be externalized.
> 
> The developer cooperation is to add //$NON-NLS-n$ as an end of line 
> comment where n stands for the string that does not need to be 
> internationalized. If there are more than one string then add more of 
> these comments to the end of the line.
> 
> For a contrived example:
> 
> System.out.println("Hello " + System.getProperty("user.name") + ". 
> Welcome to " + appName); //$NON-NLS-2$
> 
> Or
> 
> System.out.println( "(" + action + ") " + reason + " at this time"); 
> //$NON-NLS-1$ //$NON-NLS-2$
> 
> When there are strings all through the code it really begins to look 
> ugly, but if all non-externalized strings are declared as:
>   [public|protected|private] static final XXX="value"; //$NON-NLS-1
> It won't look so bad.
> 
> Then you can go to Window->Preferences->Java->Compiler->Advanced
> and set the "Usage of non-externalized strings" to something other than 
> ignore.
> Then click on Apply and say yes to recompiling.
> 
> I am including a patch for java/swing that marks all of the strings that 
> don't need to be internationalized. You will find that there are about 
> 200 strings that need to be externalized in the GUI.
> 
> If you look closely, I marked all strings that a user will not see as 
> NON-NLS. Strings that a user will or might see, I left as needing 
> externalization.
> 
> If we were to use this as a way of managing the strings, then a 
> gatekeeper could be the one to validate that all strings are externalized.
> 
> _________________________________________________________________
> Limited-time offer: Fast, reliable MSN 9 Dial-up Internet access FREE 
> for 2 months! 
> http://join.msn.com/?page=dept/dialup&pgmarket=en-us&ST=1/go/onm00200361ave/direct/01/ 
>