2 *******************************************************************************
3 * Copyright (C) 2009-2013, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
7 package com.ibm.icu.text;
11 import com.ibm.icu.impl.CurrencyData;
12 import com.ibm.icu.util.ULocale;
15 * Returns currency names localized for a locale.
17 * This class is not intended for public subclassing.
21 public abstract class CurrencyDisplayNames {
23 * Return an instance of CurrencyDisplayNames that provides information
24 * localized for display in the provided locale. If there is no data for the
25 * provided locale, this falls back to the current default locale; if there
26 * is no data for that either, it falls back to the root locale. Substitute
27 * values are returned from APIs when there is no data for the requested ISO
30 * @param locale the locale into which to localize the names
31 * @return a CurrencyDisplayNames
34 public static CurrencyDisplayNames getInstance(ULocale locale) {
35 return CurrencyData.provider.getInstance(locale, true);
39 * Return an instance of CurrencyDisplayNames that provides information
40 * localized for display in the provided locale. If noSubstitute is false,
41 * this behaves like {@link #getInstance(ULocale)}. Otherwise, 1) if there
42 * is no supporting data for the locale at all, there is no fallback through
43 * the default locale or root, and null is returned, and 2) if there is data
44 * for the locale, but not data for the requested ISO code, null is returned
45 * from those APIs instead of a substitute value.
47 * @param locale the locale into which to localize the names
48 * @param noSubstitute if true, do not return substitute values.
49 * @return a CurrencyDisplayNames
52 public static CurrencyDisplayNames getInstance(ULocale locale, boolean noSubstitute) {
53 return CurrencyData.provider.getInstance(locale, !noSubstitute);
57 * Returns true if currency display name data is available.
58 * @return true if currency display name data is available
60 * @deprecated This API is ICU internal only.
62 public static boolean hasData() {
63 return CurrencyData.provider.hasData();
67 * Returns the locale used to determine how to translate the currency names.
68 * This is not necessarily the same locale passed to {@link #getInstance(ULocale)}.
69 * @return the display locale
72 public abstract ULocale getULocale();
75 * Returns the symbol for the currency with the provided ISO code. If
76 * there is no data for the ISO code, substitutes isoCode or returns null.
78 * @param isoCode the three-letter ISO code.
79 * @return the display name.
82 public abstract String getSymbol(String isoCode);
85 * Returns the 'long name' for the currency with the provided ISO code.
86 * If there is no data for the ISO code, substitutes isoCode or returns null.
88 * @param isoCode the three-letter ISO code
89 * @return the display name
92 public abstract String getName(String isoCode);
95 * Returns a 'plural name' for the currency with the provided ISO code corresponding to
96 * the pluralKey. If there is no data for the ISO code, substitutes isoCode or
97 * returns null. If there is data for the ISO code but no data for the plural key,
98 * substitutes the 'other' value (and failing that the isoCode) or returns null.
100 * @param isoCode the three-letter ISO code
101 * @param pluralKey the plural key, for example "one", "other"
102 * @return the display name
103 * @see com.ibm.icu.text.PluralRules
106 public abstract String getPluralName(String isoCode, String pluralKey);
109 * Returns a mapping from localized symbols and currency codes to currency codes.
110 * The returned map is unmodifiable.
114 public abstract Map<String, String> symbolMap();
117 * Returns a mapping from localized names (standard and plural) to currency codes.
118 * The returned map is unmodifiable.
122 public abstract Map<String, String> nameMap();
125 * Sole constructor. (For invocation by subclass constructors,
126 * typically implicit.)
128 * @deprecated This API is ICU internal only.
130 protected CurrencyDisplayNames() {