Example #1
0
        /// <summary>
        /// Gets the name that is suitable for displaying this currency for
        /// the specified locale.  If there is no suitable display name found
        /// for the specified locale, the ISO 4217 currency code is returned.
        /// </summary>
        /// <param name="locale"> the locale for which a display name for this currency is
        /// needed </param>
        /// <returns> the display name of this currency for the specified locale </returns>
        /// <exception cref="NullPointerException"> if <code>locale</code> is null
        /// @since 1.7 </exception>
        public String GetDisplayName(Locale locale)
        {
            LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(typeof(CurrencyNameProvider));
            String result = pool.getLocalizedObject(CurrencyNameGetter.INSTANCE, locale, CurrencyCode_Renamed, DISPLAYNAME);

            if (result != null)
            {
                return(result);
            }

            // use currency code as symbol of last resort
            return(CurrencyCode_Renamed);
        }
Example #2
0
        /// <summary>
        /// Gets the symbol of this currency for the specified locale.
        /// For example, for the US Dollar, the symbol is "$" if the specified
        /// locale is the US, while for other locales it may be "US$". If no
        /// symbol can be determined, the ISO 4217 currency code is returned.
        /// </summary>
        /// <param name="locale"> the locale for which a display name for this currency is
        /// needed </param>
        /// <returns> the symbol of this currency for the specified locale </returns>
        /// <exception cref="NullPointerException"> if <code>locale</code> is null </exception>
        public String GetSymbol(Locale locale)
        {
            LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(typeof(CurrencyNameProvider));
            String symbol = pool.getLocalizedObject(CurrencyNameGetter.INSTANCE, locale, CurrencyCode_Renamed, SYMBOL);

            if (symbol != null)
            {
                return(symbol);
            }

            // use currency code as symbol of last resort
            return(CurrencyCode_Renamed);
        }