Merge lp:~aaltinisik/aeroo/trunk_add_try_aeroo into lp:aeroo/trunk
- trunk_add_try_aeroo
- Merge into trunk
Proposed by
Ahmet Altınışık
Status: | Needs review |
---|---|
Proposed branch: | lp:~aaltinisik/aeroo/trunk_add_try_aeroo |
Merge into: | lp:aeroo/trunk |
Diff against target: |
472 lines (+191/-127) 1 file modified
report_aeroo/currency_to_text.py (+191/-127) |
To merge this branch: | bzr merge lp:~aaltinisik/aeroo/trunk_add_try_aeroo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
sraps (Alistek) | Pending | ||
Review via email: mp+89110@code.launchpad.net |
Commit message
Description of the change
Turkish language and TRY add for currency to text
To post a comment you must log in.
Unmerged revisions
- 7. By Ahmet Altınışık
-
Turkish Lira and Turkish added for currency to text
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'report_aeroo/currency_to_text.py' (properties changed: +x to -x) |
2 | --- report_aeroo/currency_to_text.py 2011-11-15 10:55:19 +0000 |
3 | +++ report_aeroo/currency_to_text.py 2012-01-18 18:58:24 +0000 |
4 | @@ -2,7 +2,7 @@ |
5 | # -*- coding: utf8 -*- |
6 | |
7 | ########################################################### |
8 | -# Developed by Kaspars Vilkens - Alistek Ltd (c) 2011 |
9 | +# Developed by Kaspars Vilkens - KN dati Ltd. (c) 2009 |
10 | # pep-8, unicode and doctests by Paul Stevens, paul@nfg.nl, 2010 |
11 | # |
12 | # Supported currencies: LVL, EUR, USD, UAH |
13 | @@ -11,8 +11,8 @@ |
14 | ########################################################### |
15 | import string |
16 | |
17 | -supported_currency = ['LVL','EUR','USD', 'UAH'] |
18 | -supported_language = ['lv_LV','en_US','ru_RU', 'uk_UA'] |
19 | +supported_currency = ['LVL','EUR','USD', 'UAH', 'TRL'] |
20 | +supported_language = ['lv_LV','en_US','ru_RU', 'uk_UA', 'tr_TR'] |
21 | |
22 | def currency_to_text(sum, currency, language): |
23 | """ |
24 | @@ -81,20 +81,20 @@ |
25 | cur_in_words += u' dolāri' |
26 | elif currency == 'UAH': |
27 | cur_in_words += u' grivnas' |
28 | - |
29 | + |
30 | if sum_frc == 1 or (str(sum_frc)[-1] == '1' and str(sum_frc)[-2] != '1'): # is the fraction sum one |
31 | if currency == 'LVL': |
32 | frc_in_words += u' santīms' |
33 | elif currency == 'EUR' or currency == 'USD' : |
34 | frc_in_words += u' cents' |
35 | - elif currency == 'UAH': |
36 | + elif currency == 'UAH': |
37 | frc_in_words += u' kapeika' |
38 | else: |
39 | if currency == 'LVL': |
40 | frc_in_words += u' santīmi' |
41 | elif currency == 'EUR' or currency == 'USD': |
42 | frc_in_words += u' centi' |
43 | - elif currency == 'UAH': |
44 | + elif currency == 'UAH': |
45 | frc_in_words += u' kapeikas' |
46 | #------------------------------------ |
47 | if language == 'en_US' : |
48 | @@ -105,24 +105,69 @@ |
49 | cur_in_words += u' euro' |
50 | elif currency == 'USD': |
51 | cur_in_words += u' US dollar' |
52 | + elif currency == 'TRL': |
53 | + cur_in_words += u' Turkish lira' |
54 | else: |
55 | if currency == 'LVL': |
56 | cur_in_words += u' Latvian lats' |
57 | elif currency == 'EUR': |
58 | cur_in_words += u' euros' |
59 | + elif currency == 'TRL': |
60 | + cur_in_words += u' Turkish Liras' |
61 | elif currency == 'USD': |
62 | cur_in_words += u' dollars' |
63 | if sum_frc == 1 or (str(sum_frc)[-1] == '1' and str(sum_frc)[-2] != '1'): # is the fraction sum one |
64 | if currency == 'LVL': |
65 | frc_in_words += u' santim' |
66 | + if currency == 'TRL': |
67 | + frc_in_words += u' kurus' |
68 | elif currency == 'EUR' or currency == 'USD': |
69 | frc_in_words += u' cent' |
70 | else: |
71 | if currency == 'LVL': |
72 | frc_in_words += u' santims' |
73 | + if currency == 'TRL': |
74 | + frc_in_words += u' kuruss' |
75 | elif currency == 'EUR' or currency == 'USD' : |
76 | frc_in_words += u' cents' |
77 | #------------------------------------ |
78 | + if language == 'tr_TR' : |
79 | + if sum_cur == 1 or (str(sum_cur)[-1] == '1' and str(sum_cur)[-2] != '1'): # is the currency sum one |
80 | + if currency == 'LVL': |
81 | + cur_in_words += u' Litvanya Liatası' |
82 | + elif currency == 'EUR': |
83 | + cur_in_words += u' EURO' |
84 | + elif currency == 'TRL': |
85 | + cur_in_words += u' LİRA' |
86 | + elif currency == 'USD': |
87 | + cur_in_words += u' USD' |
88 | + else: |
89 | + if currency == 'LVL': |
90 | + cur_in_words += u' Litvanya Liatası' |
91 | + elif currency == 'EUR': |
92 | + cur_in_words += u' EURO' |
93 | + elif currency == 'TRL': |
94 | + cur_in_words += u' LİRA' |
95 | + elif currency == 'USD': |
96 | + cur_in_words += u' USD' |
97 | + if sum_frc==0: |
98 | + if currency == 'TRL': |
99 | + frc_in_words += u'' |
100 | + elif sum_frc == 1 or (str(sum_frc)[-1] == '1' and str(sum_frc)[-2] != '1'): # is the fraction sum one |
101 | + if currency == 'LVL': |
102 | + frc_in_words += u' santim' |
103 | + if currency == 'TRL': |
104 | + frc_in_words += u' KURUŞ' |
105 | + elif currency == 'EUR' or currency == 'USD': |
106 | + frc_in_words += u' sent' |
107 | + else: |
108 | + if currency == 'LVL': |
109 | + frc_in_words += u' santims' |
110 | + if currency == 'TRL': |
111 | + frc_in_words += u' KURUŞ' |
112 | + elif currency == 'EUR' or currency == 'USD' : |
113 | + frc_in_words += u' SENT' |
114 | + #------------------------------------ |
115 | if language == 'ru_RU' : |
116 | if sum_cur == 1 or (str(sum_cur)[-1] == '1' and str(sum_cur)[-2] != '1'): # is the currency sum one |
117 | if currency == 'LVL': |
118 | @@ -145,7 +190,7 @@ |
119 | cur_in_words += u' евро' |
120 | elif currency == 'USD' : |
121 | cur_in_words += u' долларов США' |
122 | - |
123 | + |
124 | if sum_frc == 1 or (str(sum_frc)[-1] == '1' and str(sum_frc)[-2] != '1') : # is the fraction one |
125 | if currency == 'LVL' : |
126 | frc_in_words += u' сантим' |
127 | @@ -163,56 +208,56 @@ |
128 | frc_in_words += u' центов' |
129 | #------------------------------------ |
130 | if language == 'uk_UA' : |
131 | - if sum_cur == 1 or (str(sum_cur)[-1] == '1' and str(sum_cur)[-2] != '1') : # is the currency sum one |
132 | - if currency == 'LVL' : |
133 | - cur_in_words += u' лат' |
134 | - elif currency == 'EUR' : |
135 | - cur_in_words += u' евро' |
136 | - elif currency == 'USD' : |
137 | - cur_in_words += u' доллар США' |
138 | - elif currency == 'UAH' : |
139 | - cur_in_words += u' гривня' |
140 | - elif (sum_cur in [2, 3, 4]) or (str(sum_cur)[-1] in ['2', '3', '4'] and str(sum_cur)[-2] != '1') : |
141 | - if currency == 'LVL' : |
142 | - cur_in_words += u' лата' |
143 | - elif currency == 'EUR' : |
144 | - cur_in_words += u' евро' |
145 | - elif currency == 'USD' : |
146 | - cur_in_words += u' доллара США' |
147 | - elif currency == 'UAH' : |
148 | - cur_in_words += u' гривні' |
149 | - elif (sum_cur >= 5 and sum_cur <= 20) or str(sum_cur)[-1] not in [2, 3, 4] : |
150 | - if currency == 'LVL' : |
151 | - cur_in_words += u' латов' |
152 | - elif currency == 'EUR' : |
153 | - cur_in_words += u' евро' |
154 | - elif currency == 'USD' : |
155 | - cur_in_words += u' долларов США' |
156 | - elif currency == 'UAH' : |
157 | - cur_in_words += u' гривень' |
158 | - |
159 | - if sum_frc == 1 or (str(sum_frc)[-1] == '1' and str(sum_frc)[-2] != '1') : # is the fraction one |
160 | - if currency == 'LVL' : |
161 | - frc_in_words += u' сантим' |
162 | - elif currency == 'EUR' or currency == 'USD' : |
163 | - frc_in_words += u' цент' |
164 | - elif currency == 'UAH' : |
165 | - frc_in_words += u' копійка' |
166 | - elif (sum_frc in [2, 3, 4]) or (str(sum_frc)[-1] in ['2', '3', '4'] and str(sum_frc)[-2] != '1') : |
167 | - if currency == 'LVL' : |
168 | - frc_in_words += u' сантима' |
169 | - elif currency == 'EUR' or currency == 'USD' : |
170 | - frc_in_words += u' цента' |
171 | - elif currency == 'UAH' : |
172 | - frc_in_words += u' копійки' |
173 | - elif (sum_frc >= 5 and sum_frc <= 20) or str(sum_frc)[-1] not in [2, 3, 4] : |
174 | - if currency == 'LVL' : |
175 | - frc_in_words += u' сантимов' |
176 | - elif currency == 'EUR' or currency == 'USD' : |
177 | - frc_in_words += u' центов' |
178 | - elif currency == 'UAH' : |
179 | - frc_in_words += u' копійок' |
180 | - frc_in_words = str(sum_frc) + u' коп.' |
181 | + if sum_cur == 1 or (str(sum_cur)[-1] == '1' and str(sum_cur)[-2] != '1') : # is the currency sum one |
182 | + if currency == 'LVL' : |
183 | + cur_in_words += u' лат' |
184 | + elif currency == 'EUR' : |
185 | + cur_in_words += u' евро' |
186 | + elif currency == 'USD' : |
187 | + cur_in_words += u' доллар США' |
188 | + elif currency == 'UAH' : |
189 | + cur_in_words += u' гривня' |
190 | + elif (sum_cur in [2, 3, 4]) or (str(sum_cur)[-1] in ['2', '3', '4'] and str(sum_cur)[-2] != '1') : |
191 | + if currency == 'LVL' : |
192 | + cur_in_words += u' лата' |
193 | + elif currency == 'EUR' : |
194 | + cur_in_words += u' евро' |
195 | + elif currency == 'USD' : |
196 | + cur_in_words += u' доллара США' |
197 | + elif currency == 'UAH' : |
198 | + cur_in_words += u' гривні' |
199 | + elif (sum_cur >= 5 and sum_cur <= 20) or str(sum_cur)[-1] not in [2, 3, 4] : |
200 | + if currency == 'LVL' : |
201 | + cur_in_words += u' латов' |
202 | + elif currency == 'EUR' : |
203 | + cur_in_words += u' евро' |
204 | + elif currency == 'USD' : |
205 | + cur_in_words += u' долларов США' |
206 | + elif currency == 'UAH' : |
207 | + cur_in_words += u' гривень' |
208 | + |
209 | + if sum_frc == 1 or (str(sum_frc)[-1] == '1' and str(sum_frc)[-2] != '1') : # is the fraction one |
210 | + if currency == 'LVL' : |
211 | + frc_in_words += u' сантим' |
212 | + elif currency == 'EUR' or currency == 'USD' : |
213 | + frc_in_words += u' цент' |
214 | + elif currency == 'UAH' : |
215 | + frc_in_words += u' копійка' |
216 | + elif (sum_frc in [2, 3, 4]) or (str(sum_frc)[-1] in ['2', '3', '4'] and str(sum_frc)[-2] != '1') : |
217 | + if currency == 'LVL' : |
218 | + frc_in_words += u' сантима' |
219 | + elif currency == 'EUR' or currency == 'USD' : |
220 | + frc_in_words += u' цента' |
221 | + elif currency == 'UAH' : |
222 | + frc_in_words += u' копійки' |
223 | + elif (sum_frc >= 5 and sum_frc <= 20) or str(sum_frc)[-1] not in [2, 3, 4] : |
224 | + if currency == 'LVL' : |
225 | + frc_in_words += u' сантимов' |
226 | + elif currency == 'EUR' or currency == 'USD' : |
227 | + frc_in_words += u' центов' |
228 | + elif currency == 'UAH' : |
229 | + frc_in_words += u' копійок' |
230 | + frc_in_words = str(sum_frc) + u' коп.' |
231 | |
232 | return (cur_in_words + ' ' + frc_in_words).strip().encode('utf-8') |
233 | |
234 | @@ -304,6 +349,7 @@ |
235 | #print 'chunk '+str(chunk) |
236 | #print 'cunknr '+str(chunknr) |
237 | words = u'' |
238 | + onethousandflag = 0 |
239 | |
240 | if language == 'lv_LV': |
241 | skaitli = [u'nulle', u'viens', u'divi', u'trīs', u'četri', u'pieci', |
242 | @@ -326,6 +372,16 @@ |
243 | daudzums = [u' hundred', u' thousand', u' million', u' billion'] |
244 | daudzumsx = daudzums |
245 | |
246 | + elif language == 'tr_TR': |
247 | + skaitli = [u'', u'BİR', u'İKİ', u'ÜÇ', u'DÖRT', u'BEŞ', u'ALTI', |
248 | + u'YEDİ', u'SEKİZ', u'DOKUZ'] |
249 | + skaitlix = [u'', u'ON', u'YİRMİ', u'OTUZ', u'KIRK', u'ELLİ', u'ATMIŞ', |
250 | + u'YETMİŞ', u'SEKSEN', u'DOKSAN'] |
251 | + skaitli_teens = [u'ON', u'ON BİR', u'ON İKİ', u'ON ÜÇ', u'ON DÖRT', |
252 | + u'ON BEŞ', u'ON ALTI', u'ON YEDİ', u'ON SEKİZ', u'ON DOKUZ'] |
253 | + daudzums = [u'YÜZ', u' BİN', u' MİLYON', u' MİLYAR'] |
254 | + daudzumsx = [u' YÜZ', u' BİN', u' MİLYON', u' MİLYAR'] |
255 | + |
256 | elif language == 'ru_RU': |
257 | skaitli = [u'ноль', u'один', u'два', u'три', u'четыре', u'пять', u'шесть', |
258 | u'семь', u'восемь', u'девять'] |
259 | @@ -338,15 +394,15 @@ |
260 | daudzumsx = [u'сoт', u' тысяч', u' миллионов', u' миллиардов'] |
261 | |
262 | elif language == 'uk_UA' : |
263 | - skaitli = [u'ноль', u'один', u'два', u'три', u'чотири', u'п\'ять', u'шість', |
264 | - u'сім', u'вісім', u'дев\'ять'] |
265 | - skaitlix = [u'', u'один', u'двa', u'три', u'чотири', u'п\'ять', u'шість', |
266 | - u'сім', u'вісім', u'дев\'ять'] |
267 | - skaitli_teens = [u'десять', u'одинадцять', u'дванадцять', u'тринадцять', |
268 | - u'чотирнадцять', u'п\'ятнадцять', u'шістнадцять', u'сімнадцять', |
269 | - u'вісімнадцять', u'дев\'ятнадцять'] |
270 | - daudzums = [u'стo', u' тисяча', u' мiллiон', u' мiллiард'] |
271 | - daudzumsx = [u'сoт', u' тисяч', u' мiллiонiв', u' мiллiардов'] |
272 | + skaitli = [u'ноль', u'один', u'два', u'три', u'чотири', u'п\'ять', u'шість', |
273 | + u'сім', u'вісім', u'дев\'ять'] |
274 | + skaitlix = [u'', u'один', u'двa', u'три', u'чотири', u'п\'ять', u'шість', |
275 | + u'сім', u'вісім', u'дев\'ять'] |
276 | + skaitli_teens = [u'десять', u'одинадцять', u'дванадцять', u'тринадцять', |
277 | + u'чотирнадцять', u'п\'ятнадцять', u'шістнадцять', u'сімнадцять', |
278 | + u'вісімнадцять', u'дев\'ятнадцять'] |
279 | + daudzums = [u'стo', u' тисяча', u' мiллiон', u' мiллiард'] |
280 | + daudzumsx = [u'сoт', u' тисяч', u' мiллiонiв', u' мiллiардов'] |
281 | digit1 = u'' |
282 | digit2 = u'' |
283 | digit3 = u'' |
284 | @@ -367,8 +423,8 @@ |
285 | # processing hundreds |
286 | if chunklength == 3 : |
287 | if digit1 == '1' : |
288 | - if language == 'lv_LV' or language == 'ru_RU' or language == 'uk_UA': |
289 | - words += daudzums[0] |
290 | + if language == 'lv_LV' or language == 'ru_RU' or language == 'uk_UA' or language == 'tr_TR': |
291 | + words +=daudzums[0] |
292 | elif language == 'en_US' : |
293 | words += skaitli[int(digit1)] + daudzumsx[0] |
294 | else : |
295 | @@ -376,6 +432,8 @@ |
296 | if int(digit1) > 1 : words += skaitli[int(digit1)] + daudzumsx[0] |
297 | elif language == 'en_US' : |
298 | if int(digit1) > 1 : words += skaitli[int(digit1)] + daudzumsx[0] |
299 | + elif language == 'tr_TR' : |
300 | + if int(digit1) > 1 : words += skaitli[int(digit1)] + daudzumsx[0] |
301 | elif language == 'ru_RU' : |
302 | if int(digit1) == 2 : |
303 | words += u'двести' |
304 | @@ -385,21 +443,21 @@ |
305 | words += u'четыреста' |
306 | elif int(digit1) >= 5 : |
307 | words += skaitli[int(digit1)] + daudzumsx[0] |
308 | - elif language == 'uk_UA' : |
309 | - if int(digit1) == 2 : |
310 | - words += u'двісті' |
311 | - elif int(digit1) == 3 : |
312 | - words += u'триста' |
313 | - elif int(digit1) == 4 : |
314 | - words += u'чотириста' |
315 | - elif int(digit1) >= 5 : |
316 | - words += skaitli[int(digit1)] + daudzumsx[0] |
317 | + elif language == 'uk_UA' : |
318 | + if int(digit1) == 2 : |
319 | + words += u'двісті' |
320 | + elif int(digit1) == 3 : |
321 | + words += u'триста' |
322 | + elif int(digit1) == 4 : |
323 | + words += u'чотириста' |
324 | + elif int(digit1) >= 5 : |
325 | + words += skaitli[int(digit1)] + daudzumsx[0] |
326 | # processing tens |
327 | if chunklength > 1: |
328 | spacer = '' |
329 | if len(words) > 0 : spacer = ' ' |
330 | if digit2 == '1': |
331 | - if language == 'lv_LV' or language == 'en_US' or language == 'ru_RU' or language == 'uk_UA': |
332 | + if language == 'lv_LV' or language == 'en_US' or language == 'ru_RU' or language == 'uk_UA' or language == 'tr_TR': |
333 | words += spacer + skaitli_teens[int(digit3)] |
334 | else: |
335 | if language == 'lv_LV': |
336 | @@ -408,7 +466,10 @@ |
337 | elif language == 'en_US': |
338 | if int(digit2) > 1 and int(digit2) > 0: |
339 | words += spacer + skaitlix[int(digit2)] + u'ty' |
340 | - elif language == 'ru_RU': |
341 | + elif language == 'tr_TR': |
342 | + if int(digit2) > 1 and int(digit2) > 0: |
343 | + words += spacer + skaitlix[int(digit2)] |
344 | + elif language == 'ru_RU': |
345 | if int(digit2) > 1 and int(digit2) < 4: |
346 | words += spacer + skaitlix[int(digit2)] + u'дцать' |
347 | elif digit2 == '4': |
348 | @@ -417,23 +478,26 @@ |
349 | words += spacer + skaitlix[int(digit2)] + u'десят' |
350 | elif digit2 == '9': |
351 | words += spacer + u'девяносто' |
352 | - elif language == 'uk_UA' : |
353 | - if int(digit2) > 1 and int(digit2) < 4: |
354 | - words += spacer + skaitlix[int(digit2)] + u'дцять' |
355 | - elif digit2 == '4': |
356 | - words += spacer + u'сорок' |
357 | - elif int(digit2) >= 5 and int(digit2) != 9: |
358 | - words += spacer + skaitlix[int(digit2)] + u'десят' |
359 | - elif digit2 == '9': |
360 | - words += spacer + u'дев\'яносто' |
361 | + elif language == 'uk_UA' : |
362 | + if int(digit2) > 1 and int(digit2) < 4: |
363 | + words += spacer + skaitlix[int(digit2)] + u'дцять' |
364 | + elif digit2 == '4': |
365 | + words += spacer + u'сорок' |
366 | + elif int(digit2) >= 5 and int(digit2) != 9: |
367 | + words += spacer + skaitlix[int(digit2)] + u'десят' |
368 | + elif digit2 == '9': |
369 | + words += spacer + u'дев\'яносто' |
370 | # processing ones |
371 | if chunklength > 0 and digit2 != '1' : |
372 | spacer = '' |
373 | if len(words) > 0: spacer = u' ' |
374 | - if language == 'lv_LV' or language == 'en_US': |
375 | - if int(digit3) > 0: |
376 | - words += spacer + skaitli[int(digit3)] |
377 | - elif language == 'ru_RU': |
378 | + if language == 'lv_LV' or language == 'en_US' or language == 'tr_TR': |
379 | + if int(digit3) > 0: |
380 | + if language == 'tr_TR' and int(chunknr) == 1 and digit3 == '1': |
381 | + onethousandflag = 1 |
382 | + else: |
383 | + words += spacer + skaitli[int(digit3)] |
384 | + elif language == 'ru_RU': |
385 | if chunknr == 1: |
386 | if int(digit3) == 1: |
387 | words += spacer + u'одна' |
388 | @@ -443,48 +507,48 @@ |
389 | words += spacer + skaitli[int(digit3)] |
390 | else: |
391 | if int(digit3) > 0: words += spacer + skaitli[int(digit3)] |
392 | - elif language == 'uk_UA' : |
393 | - if chunknr == 1 : |
394 | - if int(digit3) == 1 : words += spacer + u'одна' |
395 | - elif int(digit3) == 2 : words += spacer + u'дві' |
396 | - elif int(digit3) >= 3 and int(digit3) != 0: words += spacer + skaitli[int(digit3)] |
397 | - else: |
398 | - if int(digit3) > 0 : words += spacer + skaitli[int(digit3)] |
399 | + elif language == 'uk_UA' : |
400 | + if chunknr == 1 : |
401 | + if int(digit3) == 1 : words += spacer + u'одна' |
402 | + elif int(digit3) == 2 : words += spacer + u'дві' |
403 | + elif int(digit3) >= 3 and int(digit3) != 0: words += spacer + skaitli[int(digit3)] |
404 | + else: |
405 | + if int(digit3) > 0 : words += spacer + skaitli[int(digit3)] |
406 | # end processing |
407 | - if len(words) > 0 : |
408 | + if len(words) > 0 or onethousandflag == 1: |
409 | |
410 | if digit3 == '1' and chunknr > 0: |
411 | - return words + daudzums[chunknr] |
412 | + return words + daudzums[chunknr] |
413 | elif digit3 != '1' and chunknr > 0: |
414 | - if language == 'lv_LV' or language == 'en_US' : |
415 | - return words + daudzumsx[chunknr] |
416 | - elif language == 'ru_RU' : |
417 | - if (int(digit3) == 2 or int(digit3) == 3 or int(digit3) == 4) and digit2 != '1' : |
418 | - if chunknr == 1 : |
419 | - return words + u' тысячи' |
420 | - elif chunknr == 2 : |
421 | - return words + u' миллионa' |
422 | - elif chunknr == 3 : |
423 | - return words + u' миллиардa' |
424 | - else: |
425 | - return words + daudzumsx[chunknr] |
426 | - elif language == 'uk_UA' : |
427 | - if (int(digit3) == 2 or int(digit3) == 3 or int(digit3) == 4) and digit2 != '1' : |
428 | - if chunknr == 1 : |
429 | - return words + u' тисячі' |
430 | - elif chunknr == 2 : |
431 | - return words + u' мілліонa' |
432 | - elif chunknr == 3 : |
433 | - return words + u' мілліардa' |
434 | - else: |
435 | - return words + daudzumsx[chunknr] |
436 | - else: |
437 | - return words |
438 | + if language == 'lv_LV' or language == 'en_US' or language == 'tr_TR' : |
439 | + return words + daudzumsx[chunknr] |
440 | + elif language == 'ru_RU' : |
441 | + if (int(digit3) == 2 or int(digit3) == 3 or int(digit3) == 4) and digit2 != '1' : |
442 | + if chunknr == 1 : |
443 | + return words + u' тысячи' |
444 | + elif chunknr == 2 : |
445 | + return words + u' миллионa' |
446 | + elif chunknr == 3 : |
447 | + return words + u' миллиардa' |
448 | + else: |
449 | + return words + daudzumsx[chunknr] |
450 | + elif language == 'uk_UA' : |
451 | + if (int(digit3) == 2 or int(digit3) == 3 or int(digit3) == 4) and digit2 != '1' : |
452 | + if chunknr == 1 : |
453 | + return words + u' тисячі' |
454 | + elif chunknr == 2 : |
455 | + return words + u' мілліонa' |
456 | + elif chunknr == 3 : |
457 | + return words + u' мілліардa' |
458 | + else: |
459 | + return words + daudzumsx[chunknr] |
460 | + else: |
461 | + return words |
462 | else: |
463 | - return '' |
464 | + return '' |
465 | |
466 | |
467 | if __name__ == '__main__': |
468 | import doctest |
469 | doctest.testmod() |
470 | - |
471 | + |
472 | \ No newline at end of file |