Skip to content
Advertisement

Android currency symbol ordering

I’m getting on devices with not-english locale, the english currencies formated like this:

1 $

If I have english locale I get euro currency like:

€ 1

Using

format.setCurrency(Currency.getInstance(currency));
return format.format(amount);

Found in the documentation:

http://developer.android.com/reference/java/util/Currency.html#getSymbol()

Returns the localized currency symbol for this currency in locale. That is, given “USD” and Locale.US, you’d get “$”, but given “USD” and a non-US locale, you’d get “US$”.

If the locale only specifies a language rather than a language and a country (such as Locale.JAPANESE or {new Locale(“en”, “”)} rather than Locale.JAPAN or {new Locale(“en”, “US”)}), the ISO 4217 currency code is returned.

If there is no locale-specific currency symbol, the ISO 4217 currency code is returned.

Is not the same method but probably related. Why does it make difference the locale of my device for the symbol ordering in the currency? 1$ is incorrect no matter which locale I’m using.

Is there a way to change this?

Advertisement

Answer

The behaviour of the method is correct.

Not all countries expect the currency symbol before the amount.

If you always want the currency format to match an Americanised expectation, leave the locale as Locale.US. If you want the currency to display in a localised way, leave your implementation as is.

See this brief guide (from Microsoft, no less):

Currency Formatting

I’d guess what you may be trying to achieve is to display the currency in a format appropriate to its locale? If that’s the case, just match the locale to the currency you’re using, before calling the method.

Note that the format can even vary in the same country. In Canada, it’s reasonably common to see English speakers use the format $50.00, whereas French-Canadians may use 50,00 $.

Also see this question on UX:

https://ux.stackexchange.com/questions/22574/where-to-place-currency-symbol-when-localizing-and-what-to-do-with-odd-symbols

Advertisement