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


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

Re: i18n/l10n question

Date 2012-02-27 17:01 -0500
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: i18n/l10n question
References <XnsA005D98F1F5D2jpnasty@94.75.214.39> <4f4aeb0f$0$286$14726298@news.sunsite.dk> <XnsA005F05FB8B2Ejpnasty@94.75.214.39>
Message-ID <4f4bfd3a$0$283$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source

Show all headers | View raw


On 2/26/2012 11:30 PM, Novice wrote:
> 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?

I think that you need to use the -D's *or* (not and) use Locale.setDefault,
but else yes.

Arne

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