How do I override Currency symbols in Java?
- by edgydruid
I'm trying to print prices in Turkish Liras (ISO 4217 currency code TRY) with Java.
When I do
Currency curr = Currency.getInstance("TRY");
Locale trLocale = new Locale("tr", "TR");
System.out.println(curr.getSymbol(trLocale));
the output is: "YTL".
However, the currency symbol for Turkish Lira has recently changed from "YTL" to "TL" (as can be seen on the Wikipedia page for Turkish Lira). Formatting with NumberFormat gives a similar result.
I really don't want to write yet another Currency class, especially when Java has one built-in.
Is there a way to override Java's default currency symbol for TRY to "TL"?