Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12414

Re: i18n/l10n question

From Novice <novice@example..com>
Newsgroups comp.lang.java.programmer
Subject Re: i18n/l10n question
Date 2012-02-27 04:30 +0000
Organization Your Company
Message-ID <XnsA005F05FB8B2Ejpnasty@94.75.214.39> (permalink)
References <XnsA005D98F1F5D2jpnasty@94.75.214.39> <4f4aeb0f$0$286$14726298@news.sunsite.dk>

Show all headers | View raw


Arne Vajhøj <arne@vajhoej.dk> wrote in
news:4f4aeb0f$0$286$14726298@news.sunsite.dk: 

> On 2/26/2012 9:16 PM, Novice wrote:
>> This is basically a variant on the "additional logging questions"
>> thread I just started but with a focus on i18n.
>>
>> I'd like all of my classes to be locale-sensitive so that all of the
>> things they are displaying in GUIs, including text and error
>> messages, are displayed in the user's language (or, more precisely,
>> the language in the resource bundle that is the "closest fit" to the
>> language of the user).
>>
>> Given that my programs instantiate a variety of classes that
>> themselves display text or error messages, those classes also need to
>> know what locale the program is using. Would I be right to pass a
>> reference to the locale of the main program to each class that it
>> instantiates? Or should I be doing things differently?
> 
> I would prefer something global.
> 
> Local setDefault seems intended for this usage.
> 

If I'm following you correctly then, the program that is running should 
obtain the desired Locale - probably via JVM parameters -Duser.country 
and -Duser.language but maybe from a menu in the GUI - then do 
Locale.setDefault(). Then all classes instantiated by that class should 
just do Locale.getDefault() locally so that they use the same locale. Is 
that about right?

>> Also, what if a class isn't GUI-related at all? Should I still pass a
>> locale anyway? Again, I'm thinking of things like Enums. I wouldn't
>> normally expect an Enum to display text of any kind to a user, at
>> least directly. (The enum might determine that day number 1 in the
>> week is Monday and pass Monday to a class that displays that but the
>> enum itself isn't displaying Monday.) What about a holder class
>> (again, assuming I'm using that term correctly; I described my guess
>> in the "additional logging questions" thread): I don't see much need
>> for it to ever display text to a user (or an error message).
> 
> If you use the above, then classes that need it can access the locale.
> 
>> And what about logs? I know that the java.util.logging classes
>> provide for resource bundles so that the messages in the logs can be
>> in other languages. How common is it for log messages to be in
>> languages other than English? I have no experience with that. So much
>> computer-related stuff seems to be in English first (or English only)
>> that I'm not sure if a European company, say, would write log
>> messages in English even if it isn't the main local language (in
>> Germany say) or would they often write them in the local language?
> 
> You should argue hard to keep logging in English. It may make a lot
> of sense to use local language for end user GUI's, but logging is for
> developers and developers can read English.
> 
That's interesting. I've certainly had the impression from all the people 
in technical newsgroups - and even many non-technical ones! - who are 
obviously fluent in English even though they are from non-English 
speaking countries. But I've travelled a bit too, mostly in Europe, and 
have been pleasantly surprised to find out how widely English is spoken, 
in countries like the Netherlands or Germany.

> Whether you will succeed or not depends. A few countries are a bit
> sensitive about language.
> 
> In France and Germany you may be requested to do everything in
> French/German.
>
Fair enough. Naturally, if I'm working for someone else, I'll write 
whatever language the employer wants. 
 
> In Scandinavia then English will be accepted without discussion.
> 

Interesting.I've always been pleasantly surprised to find English in more 
places than I expected. I remember meeting a friend's sister once. They 
are ethnic Vietnamese but the sister had been living in France since they 
left Vietnam and spoke very good English although she had little 
education in it. She told me that she'd learned it from technical 
manuals. She was a system programmer and apparently they used the English 
manuals for that system ;-) 

-- 
Novice

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

i18n/l10n question Novice <novice@example..com> - 2012-02-27 02:16 +0000
  Re: i18n/l10n question Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 21:31 -0500
    Re: i18n/l10n question Novice <novice@example..com> - 2012-02-27 04:30 +0000
      Re: i18n/l10n question Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 17:01 -0500
  Re: i18n/l10n question David Lamb <dalamb@cs.queensu.ca> - 2012-02-28 07:21 -0500
    Re: i18n/l10n question Novice <novice@example..com> - 2012-02-29 14:46 +0000
      Re: i18n/l10n question David Lamb <dalamb@cs.queensu.ca> - 2012-03-10 09:13 -0500

csiph-web