mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
[tr] return Turkish 0 ordinal and cardinal (#347)
* [tr] return Turkish 0 ordinal and cardinal * add str_to_number to Turkish * try rather use Num2Word_Base
This commit is contained in:
committed by
Willem Van Onsem
parent
ea82fe11ca
commit
79a9abfaba
@@ -18,8 +18,10 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .base import Num2Word_Base
|
||||
|
||||
class Num2Word_TR(object):
|
||||
|
||||
class Num2Word_TR(Num2Word_Base):
|
||||
def __init__(self):
|
||||
self.precision = 2
|
||||
self.negword = u"eksi"
|
||||
@@ -152,6 +154,8 @@ class Num2Word_TR(object):
|
||||
wrd += self.CARDINAL_ONES.get(
|
||||
self.integers_to_read[0][0], ""
|
||||
)
|
||||
if self.integers_to_read[0][0] == "0":
|
||||
return self.ZERO
|
||||
return wrd
|
||||
|
||||
if self.total_digits_outside_triplets == 0:
|
||||
@@ -507,6 +511,8 @@ class Num2Word_TR(object):
|
||||
wrd += self.ORDINAL_ONES.get(
|
||||
self.integers_to_read[0][0], ""
|
||||
)
|
||||
if self.integers_to_read[0][0] == "0":
|
||||
return u"sıfırıncı"
|
||||
return wrd
|
||||
|
||||
if self.total_digits_outside_triplets == 0:
|
||||
|
||||
@@ -36,6 +36,7 @@ class Num2WordsTRTest(TestCase):
|
||||
"expected": u"birmilyonikibinbirlira"},
|
||||
{"test": 1100000, "to": "currency",
|
||||
"expected": u"birmilyonyüzbinlira"},
|
||||
{"test": 0, "to": "ordinal", "expected": u"sıfırıncı"},
|
||||
{"test": 1, "to": "ordinal", "expected": u"birinci"},
|
||||
{"test": 2, "to": "ordinal", "expected": u"ikinci"},
|
||||
{"test": 9, "to": "ordinal", "expected": u"dokuzuncu"},
|
||||
@@ -108,6 +109,7 @@ class Num2WordsTRTest(TestCase):
|
||||
"expected": u"birmilyonüçbininci"},
|
||||
{"test": 1200000, "to": "ordinal",
|
||||
"expected": u"birmilyonikiyüzbininci"},
|
||||
{"test": 0, "to": "cardinal", "expected": u"sıfır"},
|
||||
{"test": 1, "to": "cardinal", "expected": u"bir"},
|
||||
{"test": 2, "to": "cardinal", "expected": u"iki"},
|
||||
{"test": 9, "to": "cardinal", "expected": u"dokuz"},
|
||||
|
||||
Reference in New Issue
Block a user