Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Custom Locale to use for a java application

Reply
Thread Tools

Custom Locale to use for a java application

 
 
Arbe
Guest
Posts: n/a
 
      06-09-2010
I know I can create almost the Locale I want to use all over my
application. I also can get a NumberFormat or DateFormat instance from
that Locale, and use default formatting provided, or even customize
that default formatting as desired.

In the scenario I'm actually facing, I may have multiple different
formats to apply for a single Locale. For instance NumberFormat has as
available Locale fr_CA, but I might one to have different number
formatting styles for fr_CA. For that reason makes sense to use the
variant option on the Locale. Then I can have fr_CA_style1 and
fr_CA_style2. Imagine I do:

Locale locale = new Locale("fr","CA","style1");
NumberFormat nf = NumberFormat.getCurrencyInstance(locale);

That would five me the default NumberFormat for Locale.CANADA_FRENCH,
as my custom Locale is not part of the number format defaults.

The question then is, how can I customize/extend the list of available
Locales on those Locale sensitive classes (NumberFormat or
DateFormat), so when I try to get the instance I get my custom
instance?

Thanks in advance!
Albert
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
the relation between C++ locale and C locale zade C++ 1 03-05-2010 06:04 PM
Re: List of locale values for locale.setlocale() under Windows Gabriel Genellina Python 0 02-18-2009 12:00 AM
Create C++ std::locale without changing C locale dertopper@web.de C++ 4 08-26-2008 01:15 PM
i18n problem, involving Locale.getDisplayLanguage and Locale.getDisplayCountry Maurice Hulsman Java 1 07-25-2004 06:11 PM
locale.nl_langinfo(RADIXCHAR) vs locale.localeconv()['decimal_point'] Jeff Epler Python 2 08-31-2003 02:18 PM



Advertisments