3
X'íc+ ã @ s| d dl mZ d dlmZmZ G dd deZdefddZefdd Zdd
efddZ efd
dZ
d
dd
dd
efddZd
S )é )ÚLocale)Úformat_decimalÚ
LC_NUMERICc @ s e Zd Zdd ZdS )ÚUnknownUnitErrorc C s t j| d||f d S )Nz%s is not a known unit in %s)Ú
ValueErrorÚ__init__)ÚselfÚunitÚlocale© r ú,/tmp/pip-build-gk9425m9/babel/babel/units.pyr s zUnknownUnitError.__init__N)Ú__name__Ú
__module__Ú__qualname__r r r r r r s r Úlongc C s: t j|}t| |d}|s&t| |d|jj|i j|S )aè
Get the display name for a measurement unit in the given locale.
>>> get_unit_name("radian", locale="en")
'radians'
Unknown units will raise exceptions:
>>> get_unit_name("battery", locale="fi")
Traceback (most recent call last):
...
UnknownUnitError: battery/long is not a known unit/length in fi
:param measurement_unit: the code of a measurement unit.
Known units can be found in the CLDR Unit Validity XML file:
https://unicode.org/repos/cldr/tags/latest/common/validity/unit.xml
:param length: "short", "long" or "narrow"
:param locale: the `Locale` object or locale identifier
:return: The unit display name, or None.
)r