mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
[ADD] lang_LT: new currencies, feminine numerals
- Adding feminine numeric forms. - Implementing new currency forms: USD, GBP, PLN, RUB (with feminine numeric forms).
This commit is contained in:
@@ -22,6 +22,18 @@ from .utils import get_digits, splitbyx
|
||||
|
||||
ZERO = ('nulis',)
|
||||
|
||||
ONES_FEMININE = {
|
||||
1: ('viena',),
|
||||
2: ('dvi',),
|
||||
3: ('trys',),
|
||||
4: ('keturios',),
|
||||
5: ('penkios',),
|
||||
6: ('šešios',),
|
||||
7: ('septynios',),
|
||||
8: ('aštuonios',),
|
||||
9: ('devynios',),
|
||||
}
|
||||
|
||||
ONES = {
|
||||
1: ('vienas',),
|
||||
2: ('du',),
|
||||
@@ -73,11 +85,25 @@ THOUSANDS = {
|
||||
10: ('naintilijonas', 'naintilijonai', 'naintilijonų'),
|
||||
}
|
||||
|
||||
GENERIC_CENTS = ('centas', 'centai', 'centų')
|
||||
|
||||
|
||||
class Num2Word_LT(Num2Word_Base):
|
||||
CURRENCY_FORMS = {
|
||||
'LTL': (('litas', 'litai', 'litų'), ('centas', 'centai', 'centų')),
|
||||
'EUR': (('euras', 'eurai', 'eurų'), ('centas', 'centai', 'centų')),
|
||||
'LTL': (('litas', 'litai', 'litų'), GENERIC_CENTS),
|
||||
'EUR': (('euras', 'eurai', 'eurų'), GENERIC_CENTS),
|
||||
'USD': (('doleris', 'doleriai', 'dolerių'), GENERIC_CENTS),
|
||||
'GBP': (
|
||||
('svaras sterlingų', 'svarai sterlingų', 'svarų sterlingų'),
|
||||
('pensas', 'pensai', 'pensų')
|
||||
),
|
||||
'PLN': (
|
||||
('zlotas', 'zlotai', 'zlotų'),
|
||||
('grašis', 'grašiai', 'grašių')),
|
||||
'RUB': (
|
||||
('rublis', 'rubliai', 'rublių'),
|
||||
('kapeika', 'kapeikos', 'kapeikų')
|
||||
),
|
||||
}
|
||||
|
||||
def setup(self):
|
||||
@@ -114,7 +140,10 @@ class Num2Word_LT(Num2Word_Base):
|
||||
def to_ordinal(self, number):
|
||||
raise NotImplementedError()
|
||||
|
||||
def _int2word(self, n):
|
||||
def _cents_verbose(self, number, currency):
|
||||
return self._int2word(number, currency == 'RUB')
|
||||
|
||||
def _int2word(self, n, feminine=False):
|
||||
if n == 0:
|
||||
return ZERO[0]
|
||||
|
||||
@@ -139,7 +168,10 @@ class Num2Word_LT(Num2Word_Base):
|
||||
if n2 == 1:
|
||||
words.append(TENS[n1][0])
|
||||
elif n1 > 0:
|
||||
words.append(ONES[n1][0])
|
||||
if (i == 1 or feminine and i == 0) and n < 1000:
|
||||
words.append(ONES_FEMININE[n1][0])
|
||||
else:
|
||||
words.append(ONES[n1][0])
|
||||
|
||||
if i > 0:
|
||||
words.append(self.pluralize(x, THOUSANDS[i]))
|
||||
|
||||
Reference in New Issue
Block a user