Skip to content

Commit 79c20e7

Browse files
committed
initial commit for rework
changes from original Babel PR python-babel#660 python-babel#660
1 parent 50635d8 commit 79c20e7

File tree

4 files changed

+964
-1
lines changed

4 files changed

+964
-1
lines changed

babel/numbers.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,26 @@ def __init__(self, message: str, suggestions: list[str] | None = None) -> None:
10231023
SPACE_CHARS_RE = re.compile('|'.join(SPACE_CHARS))
10241024

10251025

1026+
def spell_number(number, locale=LC_NUMERIC, **kwargs):
1027+
"""Return value spelled out for a specific locale
1028+
1029+
:param number: the number to format
1030+
:param locale: the `Locale` object or locale identifier
1031+
:param kwargs: optional locale specific parameters
1032+
"""
1033+
speller = RuleBasedNumberFormat.negotiate(locale)
1034+
return speller.format(number, **kwargs)
1035+
1036+
1037+
def get_rbnf_rules(locale=LC_NUMERIC):
1038+
"""Return all the available public rules for a specific locale
1039+
1040+
:param locale: the `Locale` object or locale identifier
1041+
"""
1042+
speller = RuleBasedNumberFormat.negotiate(locale)
1043+
return speller.available_rulesets
1044+
1045+
10261046
def parse_number(
10271047
string: str,
10281048
locale: Locale | str | None = None,

0 commit comments

Comments
 (0)