This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Why is Locale not working here? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why is Locale not working here?" Watch "Why is Locale not working here?" New topic

Why is Locale not working here?

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196

I need to format monetary amounts by the country and the language. But I cannot seem to get the right currency symbol for all currencies. For example I have the following code..

Here I am trying to format 1000 in Euros (the official currency of Slovakia), I want the amont to appear with the currency symbol. But what I get is..

1 000,00 Sk

Is this how it is supposed to be? I checked in NumberFormat's getAvailableLocales and I am seeing that Slovakia is supported. So what am I missing?

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15096

Are you using an older version of Java? Slovakia switched to Euros relatively recently (1 January 2009 according to Wikipedia). It could be that you are using an old version of Java from the time when the official currency was still Slovakian crowns (Sk).

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: Why is Locale not working here?
It's not a secret anymore!