numbers_and_words 0.11.3 → 0.11.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.rdoc +59 -9
- data/lib/numbers_and_words.rb +2 -0
- data/lib/numbers_and_words/core_ext.rb +2 -0
- data/lib/numbers_and_words/core_ext/array.rb +2 -0
- data/lib/numbers_and_words/core_ext/float.rb +2 -0
- data/lib/numbers_and_words/core_ext/integer.rb +2 -0
- data/lib/numbers_and_words/helper_classes.rb +2 -0
- data/lib/numbers_and_words/helper_classes/array_extensions/helpers.rb +6 -4
- data/lib/numbers_and_words/helper_classes/figures_array.rb +2 -0
- data/lib/numbers_and_words/helper_classes/words_array.rb +2 -0
- data/lib/numbers_and_words/i18n.rb +2 -0
- data/lib/numbers_and_words/i18n/initialization.rb +2 -0
- data/lib/numbers_and_words/i18n/locales/numbers.hy.yml +7 -0
- data/lib/numbers_and_words/i18n/locales/numbers.kz.yml +7 -0
- data/lib/numbers_and_words/i18n/pluralization.rb +3 -1
- data/lib/numbers_and_words/i18n/plurals/cs.rb +15 -10
- data/lib/numbers_and_words/i18n/plurals/fr.rb +5 -3
- data/lib/numbers_and_words/i18n/plurals/lt.rb +10 -7
- data/lib/numbers_and_words/i18n/plurals/lv.rb +5 -3
- data/lib/numbers_and_words/i18n/plurals/plurals.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/ru.rb +15 -10
- data/lib/numbers_and_words/i18n/plurals/ua.rb +2 -0
- data/lib/numbers_and_words/strategies.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/base.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/en.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/es.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/families/base.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/vi.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/integral.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/fractional.rb +3 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages.rb +4 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/en.rb +3 -7
- data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +11 -11
- data/lib/numbers_and_words/strategies/figures_converter/languages/et.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/hy.rb +12 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/it.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +3 -3
- data/lib/numbers_and_words/strategies/figures_converter/languages/kz.rb +12 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +3 -3
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +13 -9
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/se.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/vi.rb +4 -0
- data/lib/numbers_and_words/strategies/figures_converter/options.rb +15 -2
- data/lib/numbers_and_words/strategies/figures_converter/options/base.rb +5 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +28 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb +3 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb +3 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/pronounced.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_hyphen.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_zero.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/hundreds_with_union.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +3 -10
- data/lib/numbers_and_words/strategies/figures_converter/options/en/pronounced.rb +6 -13
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_hyphen.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/es.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/es/apocopated.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/es/gender.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/es/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb +3 -50
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/gender.rb +3 -18
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/ordinal.rb +3 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/gender.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/ua/gender.rb +3 -17
- data/lib/numbers_and_words/translations.rb +4 -0
- data/lib/numbers_and_words/translations/base.rb +3 -1
- data/lib/numbers_and_words/translations/cs.rb +2 -0
- data/lib/numbers_and_words/translations/de.rb +2 -0
- data/lib/numbers_and_words/translations/en-GB.rb +2 -0
- data/lib/numbers_and_words/translations/en.rb +2 -0
- data/lib/numbers_and_words/translations/es.rb +10 -5
- data/lib/numbers_and_words/translations/et.rb +2 -0
- data/lib/numbers_and_words/translations/extensions/fraction_significance.rb +2 -0
- data/lib/numbers_and_words/translations/families/base.rb +2 -0
- data/lib/numbers_and_words/translations/families/cyrillic.rb +2 -0
- data/lib/numbers_and_words/translations/families/latin.rb +2 -0
- data/lib/numbers_and_words/translations/fr.rb +9 -7
- data/lib/numbers_and_words/translations/hu.rb +2 -0
- data/lib/numbers_and_words/translations/hy.rb +21 -0
- data/lib/numbers_and_words/translations/it.rb +2 -0
- data/lib/numbers_and_words/translations/ka.rb +3 -1
- data/lib/numbers_and_words/translations/kz.rb +9 -0
- data/lib/numbers_and_words/translations/lt.rb +2 -0
- data/lib/numbers_and_words/translations/lv.rb +2 -0
- data/lib/numbers_and_words/translations/nl.rb +3 -0
- data/lib/numbers_and_words/translations/pt-BR.rb +9 -2
- data/lib/numbers_and_words/translations/pt.rb +3 -0
- data/lib/numbers_and_words/translations/ru.rb +2 -0
- data/lib/numbers_and_words/translations/se.rb +2 -0
- data/lib/numbers_and_words/translations/tr.rb +2 -0
- data/lib/numbers_and_words/translations/ua.rb +2 -0
- data/lib/numbers_and_words/translations/vi.rb +5 -2
- data/lib/numbers_and_words/version.rb +3 -1
- data/lib/numbers_and_words/wrappers.rb +2 -0
- data/lib/numbers_and_words/wrappers/float.rb +3 -1
- data/lib/numbers_and_words/wrappers/integer.rb +2 -0
- metadata +28 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ea9d33b86d78e18e90469a44a76b104680aab00f84a7adc231c6b39dd6c658be
|
4
|
+
data.tar.gz: 35fc2539c95700e447913526265a62d43006b8e963ee9bf61324fd1f0c1d4075
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1b10a1a58c9db1e44d43bdeefe11c4f9ccb1e7ada04fae531edcc1d85055eb51b3c0ce1ed9086fcdc144387c1d45c9762263433e0187c3d1d9d73426bd9c9a5
|
7
|
+
data.tar.gz: 743962ff8a5e9b2406e609da7be0b35d246592ab2c108b5469c9682f1887c1b59ca1bb77b3304f777be339edaa60077621cdb79e5a6e4f0440971f9e1074fd60
|
data/README.rdoc
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
== numbers_and_words
|
2
2
|
|
3
3
|
{<img src="https://badge.fury.io/rb/numbers_and_words.svg?branch=master" alt="Gem Version" />}[http://badge.fury.io/rb/numbers_and_words]
|
4
|
-
{<img src="https://gemnasium.com/kslazarev/numbers_and_words.svg?branch=master" alt="Dependency Status" />}[https://gemnasium.com/kslazarev/numbers_and_words]
|
5
4
|
{<img src="https://codeclimate.com/github/kslazarev/numbers_and_words.svg?branch=master" />}[https://codeclimate.com/github/kslazarev/numbers_and_words]
|
6
5
|
{<img src="https://secure.travis-ci.org/kslazarev/numbers_and_words.svg?branch=master" />}[http://travis-ci.org/kslazarev/numbers_and_words]
|
7
6
|
{<img src="https://coveralls.io/repos/kslazarev/numbers_and_words/badge.svg?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/kslazarev/numbers_and_words]
|
8
7
|
|
9
|
-
|
8
|
+
Spell out numbers in several languages using the I18n gem.
|
10
9
|
|
11
10
|
Перевод чисел в слова при помощи библиотеки I18n.
|
12
11
|
|
@@ -16,7 +15,9 @@ Számok betűvel írva az I18n könyvtár segítségével.
|
|
16
15
|
|
17
16
|
I18n kütüphanesi ile sayıları yazıya çevirir.
|
18
17
|
|
19
|
-
|
18
|
+
Soletra números em vários idiomas utilizando a biblioteca I18n.
|
19
|
+
|
20
|
+
Deletrea números en varios idiomas utilizando la gema I18n.
|
20
21
|
|
21
22
|
== Supported Languages / Языки / Langues Supportées
|
22
23
|
|
@@ -39,11 +40,12 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
39
40
|
* Česky [cs]
|
40
41
|
* Português [pt]
|
41
42
|
* Português Brasileiro [pt-BR]
|
43
|
+
* հայերեն (Armenian) [hy]
|
44
|
+
* Қазақша [kz]
|
42
45
|
|
43
46
|
** Experimental
|
44
47
|
|
45
48
|
* {[en-AU], [en-CA], [en-IN], [en-US]}*** => [en]
|
46
|
-
* {[es-419], [es-AR], [es-CL], [es-CO], [es-MX], [es-PE], [es-VE]}*** => [es]
|
47
49
|
* {[fr-CA], [fr-CH]}*** => [fr]
|
48
50
|
* {[de], [de-AT], [de-CH]}*** => [de]
|
49
51
|
* {[it-CH]}*** => [it]
|
@@ -85,6 +87,12 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
85
87
|
I18n.with_locale(:vi) { 42.to_words }
|
86
88
|
=> "bốn mươi hai"
|
87
89
|
|
90
|
+
I18n.with_locale(:hy) { 42.to_words }
|
91
|
+
=> "քառասուն երկու"
|
92
|
+
|
93
|
+
I18n.with_locale(:kz) { 42.to_words }
|
94
|
+
=> "қырық екi"
|
95
|
+
|
88
96
|
21.to_words
|
89
97
|
=> "twenty-one"
|
90
98
|
=> "veintiuno"
|
@@ -104,6 +112,8 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
104
112
|
=> "dvacetjedna"
|
105
113
|
=> "vinte e um"
|
106
114
|
=> "hai mươi mốt"
|
115
|
+
=> "քսան մեկ"
|
116
|
+
=> "жиырма бiр"
|
107
117
|
|
108
118
|
231.to_words
|
109
119
|
=> "two hundred thirty-one"
|
@@ -124,6 +134,8 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
124
134
|
=> "dvě stě třicetjedna"
|
125
135
|
=> "duzentos e trinta e um"
|
126
136
|
=> "hai trăm ba mươi mốt"
|
137
|
+
=> "երկու հարյուր երեսուն մեկ"
|
138
|
+
=> "екi жүз отыз бiр"
|
127
139
|
|
128
140
|
4030.to_words
|
129
141
|
=> "four thousand thirty"
|
@@ -143,6 +155,8 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
143
155
|
=> "fyra tusen trettio"
|
144
156
|
=> "čtyři tisíce třicet"
|
145
157
|
=> "bốn nghìn không trăm ba mươi"
|
158
|
+
=> "չորս հազար երեսուն"
|
159
|
+
=> "төрт мың отыз"
|
146
160
|
|
147
161
|
1000100.to_words
|
148
162
|
=> "one million one hundred"
|
@@ -162,6 +176,8 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
162
176
|
=> "en miljoner en hundra"
|
163
177
|
=> "jeden milión jedno sto"
|
164
178
|
=> "một triệu một trăm"
|
179
|
+
=> "մեկ միլիոն հարյուր"
|
180
|
+
=> "бiр миллион бiр жүз"
|
165
181
|
|
166
182
|
1000000000000000000000000000000000.to_words
|
167
183
|
=> "one decillion"
|
@@ -179,6 +195,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
179
195
|
=> "één decillion"
|
180
196
|
=> "en decillion"
|
181
197
|
=> "decilijon"
|
198
|
+
=> "бiр дециллион"
|
182
199
|
|
183
200
|
[1, 2, 3].to_words
|
184
201
|
=> ["one", "two", "three"]
|
@@ -192,6 +209,8 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
192
209
|
=> ["ერთი", "ორი", "სამი"]
|
193
210
|
=> ["jedna", "dva", "tři"]
|
194
211
|
=> ["một", "hai", "ba"]
|
212
|
+
=> ["մեկ", "երկու", "երեք"]
|
213
|
+
=> ["бiр", "екi", "үш"]
|
195
214
|
|
196
215
|
[11, 22, 133].to_words
|
197
216
|
=> ["eleven", "twenty-two", "one hundred thirty-three"]
|
@@ -211,6 +230,8 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
211
230
|
=> ["elva", "tjugo-två", "en hundra trettio-tre"]
|
212
231
|
=> ["jedenáct", "dvacetdva", "jedno sto třicettři"]
|
213
232
|
=> ["mười một", "hai mươi hai", "một trăm ba mươi ba"]
|
233
|
+
=> ["տասնմեկ", "քսան երկու", "հարյուր երեսուն երեք"]
|
234
|
+
=> ["он бiр", "жиырма екi", "бiр жүз отыз үш"]
|
214
235
|
|
215
236
|
21.77.to_words
|
216
237
|
=> "twenty-one and seventy-seven hundredths"
|
@@ -270,7 +291,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
270
291
|
|
271
292
|
* Brazilian Portuguese
|
272
293
|
|
273
|
-
Change gender form: (gender: [:female || :male
|
294
|
+
Change gender form: (gender: [:female || :male])
|
274
295
|
|
275
296
|
I18n.with_locale(:'pt-BR') { 1000000001.to_words gender: :female }
|
276
297
|
=> "um bilhão e uma"
|
@@ -288,7 +309,6 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
288
309
|
I18n.with_locale(:'cs') { 1.to_words gender: :neuter }
|
289
310
|
=> "jedno"
|
290
311
|
|
291
|
-
|
292
312
|
Remove 'zero' from integral part of float: (remove_zero: [true || false])
|
293
313
|
|
294
314
|
I18n.with_locale(:cs) { 0.7.to_words }
|
@@ -305,19 +325,49 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
305
325
|
I18n.with_locale(:cs) { 21.to_words gender: :female, ordinal: true }
|
306
326
|
=> "dvacátá první"
|
307
327
|
|
328
|
+
* Spanish
|
329
|
+
|
330
|
+
Change gender form: (gender: [:female || :male])
|
331
|
+
|
332
|
+
I18n.with_locale(:es) { 1.to_words gender: :female }
|
333
|
+
=> "una"
|
334
|
+
|
335
|
+
I18n.with_locale(:es) { 1.to_words gender: :male }
|
336
|
+
=> "uno"
|
337
|
+
|
338
|
+
Use the apocopated (shortened) form: (apocopated: [true || false])
|
339
|
+
|
340
|
+
I18n.with_locale(:es) { 1.to_words apocopated: true }
|
341
|
+
=> "un"
|
342
|
+
|
343
|
+
Mix gender and apocopated forms:
|
344
|
+
|
345
|
+
I18n.with_locale(:es) { 201.to_words gender: :female, apocopated: true }
|
346
|
+
=> "doscientas un"
|
347
|
+
|
348
|
+
Remove 'zero' from integral part of float: (remove_zero: [true || false])
|
349
|
+
|
350
|
+
I18n.with_locale(:es) { 0.7.to_words }
|
351
|
+
=> "cero con siete décimas"
|
352
|
+
|
353
|
+
I18n.with_locale(:es) { 0.7.to_words remove_zero: true }
|
354
|
+
=> "siete décimas"
|
355
|
+
|
308
356
|
== Other options / Другие опции
|
309
357
|
|
310
|
-
*
|
358
|
+
* Precision
|
311
359
|
|
312
360
|
You may pass argument :precision that added zeros to the end of float number:
|
313
361
|
|
314
362
|
I18n.with_locale(:ru) { 0.1.to_words precision: 3 }
|
315
363
|
=> ноль целых и десять сотых
|
316
364
|
|
365
|
+
I18n.with_locale(:es) { 0.2.to_words precision: 2 }
|
366
|
+
=> cero con veinte centésimas
|
367
|
+
|
317
368
|
== Requirements / Требования / Configuration Requise
|
318
369
|
|
319
|
-
*
|
320
|
-
* 1.8.7 <= Ruby <= 1.9.2 (-v 0.9.0)
|
370
|
+
* 2.5 <= Ruby (compatible with/совместимость с/compatible avec Ruby 2.5 and/и/et JRuby);
|
321
371
|
* 0.5.0 <= I18n (earlier versions not tested/ранние версии не тестировались/versions précédentes non testées);
|
322
372
|
|
323
373
|
== Installation / Установка / Installation
|
data/lib/numbers_and_words.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module ArrayExtensions
|
3
5
|
module Helpers
|
@@ -37,7 +39,7 @@ module NumbersAndWords
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def ones
|
40
|
-
self[0].to_i if self[0].to_i
|
42
|
+
self[0].to_i if self[0].to_i.positive?
|
41
43
|
end
|
42
44
|
|
43
45
|
def teens
|
@@ -45,7 +47,7 @@ module NumbersAndWords
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def tens
|
48
|
-
self[1].to_i if self[1]
|
50
|
+
self[1].to_i if self[1].to_i.positive?
|
49
51
|
end
|
50
52
|
|
51
53
|
def tens_with_ones
|
@@ -53,7 +55,7 @@ module NumbersAndWords
|
|
53
55
|
end
|
54
56
|
|
55
57
|
def hundreds
|
56
|
-
self[2].to_i if self[2].to_i
|
58
|
+
self[2].to_i if self[2].to_i.positive?
|
57
59
|
end
|
58
60
|
|
59
61
|
def round_hundred?
|
@@ -77,7 +79,7 @@ module NumbersAndWords
|
|
77
79
|
end
|
78
80
|
|
79
81
|
def ordinal_index
|
80
|
-
index
|
82
|
+
index(&:positive?)
|
81
83
|
end
|
82
84
|
|
83
85
|
def ordinal_capacity
|
@@ -0,0 +1,7 @@
|
|
1
|
+
hy:
|
2
|
+
numbers:
|
3
|
+
ones: [զրո, մեկ, երկու, երեք, չորս, հինգ, վեց, յոթ, ութ, ինը]
|
4
|
+
teens: [_, տասնմեկ, տասներկու, տասներեք, տասնչորս, տասնհինգ, տասնվեց, տասնյոթ, տասնութ, տասնինը]
|
5
|
+
tens: [_, տասը, քսան, երեսուն, քառասուն, հիսուն, վաթսուն, յոթանասուն, ութսուն, իննսուն]
|
6
|
+
hundreds: հարյուր
|
7
|
+
mega: [_, հազար, միլիոն, միլիարդ, տրիլիոն, քառակուսի]
|
@@ -0,0 +1,7 @@
|
|
1
|
+
kz:
|
2
|
+
numbers:
|
3
|
+
ones: [нөл, бiр, екi, үш, төрт, бес, алты, жетi, сегiз, тоғыз]
|
4
|
+
teens: [_, он бiр, он екi, он үш, он төрт, он бес, он алты, он жетi, он сегiз, он тоғыз]
|
5
|
+
tens: [_, он, жиырма, отыз, қырық, елу, алпыс, жетпiс, сексен, тоқсан]
|
6
|
+
hundreds: жүз
|
7
|
+
mega: [_, мың, миллион, миллиард, триллион, квадриллион, квинтиллион, секстиллион, септиллион, октиллион, нониллион, дециллион]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'numbers_and_words/i18n/plurals/cs'
|
2
4
|
require 'numbers_and_words/i18n/plurals/ru'
|
3
5
|
require 'numbers_and_words/i18n/plurals/ua'
|
@@ -12,7 +14,7 @@ module NumbersAndWords
|
|
12
14
|
|
13
15
|
def init
|
14
16
|
::I18n.load_path << config_file
|
15
|
-
::I18n::Backend::Simple.
|
17
|
+
::I18n::Backend::Simple.include ::I18n::Backend::Pluralization
|
16
18
|
end
|
17
19
|
|
18
20
|
def files
|
@@ -1,31 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Cs
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = lambda do |
|
8
|
-
if one_conditions(
|
9
|
+
RULE = lambda do |number|
|
10
|
+
if one_conditions(number)
|
9
11
|
:one
|
10
|
-
elsif few_conditions(
|
12
|
+
elsif few_conditions(number)
|
11
13
|
:few
|
12
|
-
elsif many_conditions(
|
14
|
+
elsif many_conditions(number)
|
13
15
|
:many
|
14
16
|
else
|
15
17
|
:other
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
def one_conditions(
|
20
|
-
|
21
|
+
def one_conditions(number)
|
22
|
+
number % 10 == 1 && number % 100 != 11
|
21
23
|
end
|
22
24
|
|
23
|
-
def few_conditions(
|
24
|
-
[2, 3, 4].include?(
|
25
|
+
def few_conditions(number)
|
26
|
+
[2, 3, 4].include?(number % 10) &&
|
27
|
+
![12, 13, 14].include?(number % 100)
|
25
28
|
end
|
26
29
|
|
27
|
-
def many_conditions(
|
28
|
-
(
|
30
|
+
def many_conditions(number)
|
31
|
+
(number % 10).zero? ||
|
32
|
+
[5, 6, 7, 8, 9].include?(number % 10) ||
|
33
|
+
[11, 12, 13, 14].include?(number % 100)
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Fr
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = ->(
|
9
|
+
RULE = ->(number) { one_conditions(number) ? :one : :other }
|
8
10
|
|
9
|
-
def one_conditions(
|
10
|
-
|
11
|
+
def one_conditions(number)
|
12
|
+
number % 10 == 1 && number % 100 != 11
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -1,25 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Lt
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = lambda do |
|
8
|
-
if one_conditions(
|
9
|
+
RULE = lambda do |number|
|
10
|
+
if one_conditions(number)
|
9
11
|
:one
|
10
|
-
elsif ones_conditions(
|
12
|
+
elsif ones_conditions(number)
|
11
13
|
:ones
|
12
14
|
else
|
13
15
|
:other
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
|
-
def one_conditions(
|
18
|
-
|
19
|
+
def one_conditions(number)
|
20
|
+
number % 10 == 1 && number % 100 != 11
|
19
21
|
end
|
20
22
|
|
21
|
-
def ones_conditions(
|
22
|
-
[2, 3, 4, 5, 6, 7, 8, 9].include?(
|
23
|
+
def ones_conditions(number)
|
24
|
+
[2, 3, 4, 5, 6, 7, 8, 9].include?(number % 10) &&
|
25
|
+
![12, 13, 14, 15, 16, 17, 18, 19].include?(number % 100)
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Lv
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = ->(
|
9
|
+
RULE = ->(number) { one_conditions(number) ? :one : :other }
|
8
10
|
|
9
|
-
def one_conditions(
|
10
|
-
|
11
|
+
def one_conditions(number)
|
12
|
+
number % 10 == 1 && number % 100 != 11
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|