mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
Merge pull request #100 from shulcsm/pass_kwargs_to_converters
Pass kwargs to converters.
This commit is contained in:
@@ -76,7 +76,7 @@ CONVERTER_CLASSES = {
|
|||||||
CONVERTES_TYPES = ['cardinal', 'ordinal', 'year', 'currency']
|
CONVERTES_TYPES = ['cardinal', 'ordinal', 'year', 'currency']
|
||||||
|
|
||||||
|
|
||||||
def num2words(number, ordinal=False, lang='en', to='cardinal'):
|
def num2words(number, ordinal=False, lang='en', to='cardinal', **kwargs):
|
||||||
# We try the full language first
|
# We try the full language first
|
||||||
if lang not in CONVERTER_CLASSES:
|
if lang not in CONVERTER_CLASSES:
|
||||||
# ... and then try only the first 2 letters
|
# ... and then try only the first 2 letters
|
||||||
@@ -91,4 +91,4 @@ def num2words(number, ordinal=False, lang='en', to='cardinal'):
|
|||||||
if to not in CONVERTES_TYPES:
|
if to not in CONVERTES_TYPES:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
return getattr(converter, 'to_{}'.format(to))(number)
|
return getattr(converter, 'to_{}'.format(to))(number, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user