diff babel/numbers.py @ 387:88e3589ca8df

Improve CLDR import of currency-related data to ignore unsupported features such as symbol choice patterns and pluralized display names. See #93.
author cmlenz
date Fri, 11 Jul 2008 13:47:28 +0000
parents 841858d5b567
children f03cc3bed4e1
line wrap: on
line diff
--- a/babel/numbers.py
+++ b/babel/numbers.py
@@ -40,6 +40,20 @@
 
 LC_NUMERIC = default_locale('LC_NUMERIC')
 
+def get_currency_name(currency, locale=LC_NUMERIC):
+    """Return the name used by the locale for the specified currency.
+    
+    >>> get_currency_name('USD', 'en_US')
+    u'US Dollar'
+    
+    :param currency: the currency code
+    :param locale: the `Locale` object or locale identifier
+    :return: the currency symbol
+    :rtype: `unicode`
+    :since: version 0.9.4
+    """
+    return Locale.parse(locale).currencies.get(currency, currency)
+
 def get_currency_symbol(currency, locale=LC_NUMERIC):
     """Return the symbol used by the locale for the specified currency.
     
Copyright (C) 2012-2017 Edgewall Software