Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4587022
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:43:17+00:00 2026-05-21T21:43:17+00:00

Recently Sun/Oracle changed currency code for Ukrainian hrivna to incorrect one and I’ve to

  • 0

Recently Sun/Oracle changed currency code for Ukrainian hrivna to incorrect one and I’ve to fix that in my code.

I find out that Java 6 should allows me to do that at Java level (details are here) via CurrencyNameProvider (see also).

Unfortunately I don’t understand which locales should return method

public Locale[] getAvailableLocales() {}

Any working examples are welcome!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:43:18+00:00Added an answer on May 21, 2026 at 9:43 pm

    LocaleServiceProvider:Locale sensitive factory methods and methods for name retrieval in the java.text and java.util packages invoke service provider methods when needed to support the requested locale. The methods first check whether the Java runtime environment itself supports the requested locale, and use its support if available. Otherwise, they call the getAvailableLocales() methods of installed providers for the appropriate interface to find one that supports the requested locale.

    So if the JRE has support for the requested Locale, you cannot override it with a custom provider in your extension, because the default providers will be asked first.

    Example, which tries to provide a new symbol for UAH for Locale xx_YY BungaBunga and uk_UA ungarn$$$ :

    public class UkCurrencyNameProvider extends CurrencyNameProvider {
    private static final Locale XX_YY = new Locale("xx", "YY");
    private static final Locale UK_UA = new Locale("uk", "UA");
    private static final Map<Locale, String> SYMBOL_MAP;
    static {
    SYMBOL_MAP = new HashMap<Locale, String>();
    UkCurrencyNameProvider.SYMBOL_MAP.put(UkCurrencyNameProvider.XX_YY,
            "BungaBunga");
    UkCurrencyNameProvider.SYMBOL_MAP.put(UK_UA, "ungarn$$$");
    }
    private static final Locale[] AVAILABLE_LOCALES = UkCurrencyNameProvider.SYMBOL_MAP
            .keySet().toArray(
                    new Locale[UkCurrencyNameProvider.SYMBOL_MAP.size()]);
    
    /*
     * (non-Javadoc)
     * @see java.util.spi.CurrencyNameProvider#getSymbol(java.lang.String,
     * java.util.Locale)
     */
    @Override
    public String getSymbol(final String currencyCode, final Locale locale) {
        final String result;
        if ("UAH".equals(currencyCode)) {
        result = UkCurrencyNameProvider.SYMBOL_MAP.get(locale);
        } else {
        result = null;
        }
        return result;
    }
    
    /*
     * (non-Javadoc)
     * @see java.util.spi.LocaleServiceProvider#getAvailableLocales()
     */
    @Override
    public Locale[] getAvailableLocales() {
        return UkCurrencyNameProvider.AVAILABLE_LOCALES.clone();
    
    }
    

    }

    The code

    Locale[] test=new Locale[] {new Locale("xx","YY"),new Locale("uk","UA")};
    for (Locale loc:test)
     {System.out.println(loc+": "+Currency.getInstance("UAH").getSymbol(loc));}
    

    will output

    xx_YY: BungaBunga

    uk_UA: грл.

    because the standard JRE knows about uk_UA and will provide its already known currency symbol грл.. For xx_YY the JRE has none information and will ask the providers in the extension. The custom provider will return BungaBunga.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently discovered that MVC is supposed to have two different flavors, model one
I recently switched one of my static html files to a Spring controller that
Recently I've spotted a very disturbing issue. I've got the following python code: for
Recently I just got assigned a project to develop a web application/site that uses
Recently I have been learning about WMI and WQL. I found out the list
Recently I've wanted to do a number of things using CSS only to find
I recently updated my computer to a more powerful one, with a quad-core hyperthreading
We've recently migrated our systems from Sun Java 5 to Java6 server VM (specifically,
I recently read the blog posts on Pushing Pixels that describe how to achieve
Relatively new to python. I recently posted a question in regards to validating that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.