Merge branch 'master' into master

This commit is contained in:
Marlon Rodriguez Garcia
2022-08-19 15:26:55 -04:00
committed by GitHub
6 changed files with 33 additions and 6 deletions

View File

@@ -1,6 +1,21 @@
Changelog Changelog
========= =========
Version 0.5.12 -- 2022/08/19
----------------------------
* Support Japanese Reiwa (令和/れいわ) era. (#412)
* Add basic farsi support (#354)
* Added Tajik language support (#406)
* Fix Amharic language support (#465)
* Fix Hebrew pluralize and implement to_currency (#330)
* Add support to translate some currencies in italian language (#434)
* Fix Polish twenties (#345)
* Add uzs for ru and en (#422)
* Added support for Esperanto numbers. (#387)
* [ADD] to ordinal number for Turkish (#468)
* Fix zeroth in Dutch to nulde fixing (#326)
Version 0.5.11 -- 2022/08/03 Version 0.5.11 -- 2022/08/03
---------------------------- ----------------------------
@@ -77,9 +92,9 @@ Version 0.5.7 -- 2018/06/27
* Add Finnish localization. (#170) * Add Finnish localization. (#170)
* Add Japanese localization. (#171) * Add Japanese localization. (#171)
* Add belgian-french localization. (#151) * Add belgian-french localization. (#151)
* Add Czech localization. (#154) * Add Czech localization. (#154)
* Add Thai localization. (#139) * Add Thai localization. (#139)
* Improve English localization. (#144) * Improve English localization. (#144)
* Improve Spanish localization. (#167) * Improve Spanish localization. (#167)
* Improve Italian localization. (#143) * Improve Italian localization. (#143)
* Improve documentation. (#155, #145, #174) * Improve documentation. (#155, #145, #174)

View File

@@ -34,7 +34,7 @@ Options:
-t --to=<to> Output converter [default: cardinal]. -t --to=<to> Output converter [default: cardinal].
-h --help Show this message. -h --help Show this message.
-v --version Show version. -v --version Show version.
Examples: Examples:
$ num2words 10001 $ num2words 10001
ten thousand and one ten thousand and one
@@ -55,7 +55,7 @@ import sys
from docopt import docopt from docopt import docopt
import num2words import num2words
__version__ = "0.5.11" __version__ = "0.5.12"
__license__ = "LGPL" __license__ = "LGPL"

View File

@@ -76,7 +76,10 @@ class Num2Word_NL(Num2Word_EU):
"zes", "vijf", "vier", "drie", "twee", "één", "zes", "vijf", "vier", "drie", "twee", "één",
"nul"] "nul"]
self.ords = {"één": "eerst", # Wiktionary says it is "nulde", not "nulte" or "nule"
# https://en.wiktionary.org/wiki/nulde
self.ords = {"nul": "nuld",
"één": "eerst",
"twee": "tweed", "twee": "tweed",
"drie": "derd", "drie": "derd",
"vier": "vierd", "vier": "vierd",

View File

@@ -806,6 +806,10 @@ class Num2Word_TR(Num2Word_Base):
return wrd return wrd
def to_ordinal_num(self, value):
self.verify_ordinal(value)
return "%s%s" % (value, self.to_ordinal(value)[-4:])
def to_splitnum(self, val): def to_splitnum(self, val):
float_digits = str(int(val * 10 ** self.precision)) float_digits = str(int(val * 10 ** self.precision))
if not int(val) == 0: if not int(val) == 0:

View File

@@ -36,6 +36,7 @@ class Num2WordsNLTest(TestCase):
) )
def test_ordinal_at_crucial_number(self): def test_ordinal_at_crucial_number(self):
self.assertEqual(num2words(0, ordinal=True, lang='nl'), "nulde")
self.assertEqual(num2words(100, ordinal=True, lang='nl'), "honderdste") self.assertEqual(num2words(100, ordinal=True, lang='nl'), "honderdste")
self.assertEqual( self.assertEqual(
num2words(1000, ordinal=True, lang='nl'), "duizendste" num2words(1000, ordinal=True, lang='nl'), "duizendste"

View File

@@ -182,7 +182,11 @@ class Num2WordsTRTest(TestCase):
{"test": 101101011010.02, "to": "cardinal", {"test": 101101011010.02, "to": "cardinal",
"expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgüliki"}, "expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgüliki"},
{"test": 101101011010.2, "to": "cardinal", {"test": 101101011010.2, "to": "cardinal",
"expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgülyirmi"} "expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgülyirmi"},
{"test": 10, "to": "ordinal_num", "expected": u"10uncu"},
{"test": 1, "to": "ordinal_num", "expected": u"1inci"},
{"test": 3, "to": "ordinal_num", "expected": u"3üncü"},
{"test": 6, "to": "ordinal_num", "expected": u"6ıncı"}
] ]
for casedata in testcases: for casedata in testcases: