Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems in setting a locale

 
Pallavi Vidhate
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to display my data (which is numeric) in German format.
I am able to do so using the following code :
double dbl=2345.67;
NumberFormat nf= NumberFormat.getInstance(Locale.GERMAN);
((DecimalFormat)nf).applyPattern("#,##0.#");
str_output=nf.format(dbl);
But this code works only on some machines.
On other machines it shows the data in the default English format only.
Pls help.
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pallavi,
Probably the Locale that you need is not installed on certain machines. Use getAvailableLocales() method to get the list if available Locales at the particular machines.
If the GERMAN locale is not installed then it probably defaults to the English locale.
Hope this helps.
-Kaustubh.
[ May 01, 2003: Message edited by: Kaustubh Patil ]
 
Pallavi Vidhate
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kaustubh,
I have already used the method getavailablelocales.and i found that even if a particular locale (for eg: german) is not installed on a machine,i am able to set the locale to that format.
The problem is it works on some machines only.and i don't know the reason why it works that way.and that is what i would like to know.
Thanx anyways.
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You wouldn't have any trouble in setting the Locale even if that perticular Locale is not installed on a particulat machine. No validity check is performed while constructing a Locale.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!