numbers_and_words 0.11.11 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +273 -0
- data/README.rdoc +26 -6
- data/lib/numbers_and_words/helper_classes/figures_array.rb +2 -2
- data/lib/numbers_and_words/helper_classes/words_array.rb +2 -2
- data/lib/numbers_and_words/i18n/locales/numbers.da.yml +52 -0
- data/lib/numbers_and_words/i18n/pluralization.rb +0 -1
- data/lib/numbers_and_words/i18n/plurals/plurals.rb +2 -2
- data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/da.rb +56 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +3 -3
- data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +4 -4
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +2 -2
- data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +20 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +5 -5
- data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages.rb +1 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/options/da/gender.rb +14 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/da.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +3 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/nl/tens_of_hundreds.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/nl.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/options.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter.rb +2 -2
- data/lib/numbers_and_words/translations/da.rb +37 -0
- data/lib/numbers_and_words/translations/es.rb +1 -1
- data/lib/numbers_and_words/translations/et.rb +1 -1
- data/lib/numbers_and_words/translations/fr.rb +3 -3
- data/lib/numbers_and_words/translations/hu.rb +1 -1
- data/lib/numbers_and_words/translations/it.rb +1 -1
- data/lib/numbers_and_words/translations/nl.rb +1 -1
- data/lib/numbers_and_words/translations/pt-BR.rb +3 -3
- data/lib/numbers_and_words/translations/pt.rb +1 -1
- data/lib/numbers_and_words/translations/se.rb +1 -1
- data/lib/numbers_and_words/translations.rb +1 -0
- data/lib/numbers_and_words/version.rb +1 -1
- data/lib/numbers_and_words/wrappers/float.rb +1 -1
- metadata +13 -5
- data/lib/numbers_and_words/i18n/plurals/fr.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7503257030adb52e2ff1704101a18dce89c3f20adbf07f259f7483452098d3b
|
4
|
+
data.tar.gz: ac2e88eb5d1d0fc1cd3aa2f7107dea6b83a8c96818280ff4e410f0e77055e656
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8f82e6d2cadd49ca7af046963f4db230d86511a0d09bf0b9404a8f1373df2a4076e418ec5645f14626082cc79ce64574d5c4a1beada1ac6412c24a633f873a5
|
7
|
+
data.tar.gz: 1920bfb10e576382d1cdfc439ad870baf3d1e6db53193b29a63a05403c32340fb0e32dd9a7cf579b14f5a8702ec6b5874e36f02f9b69eb9e46174ff8d570fea3
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,273 @@
|
|
1
|
+
## 1.1.0 (Next)
|
2
|
+
|
3
|
+
### Features
|
4
|
+
* Your contribution here.
|
5
|
+
|
6
|
+
## 1.0.0 (October 17, 2024)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
* Add support for Danish language. \[[#197](https://github.com/kslazarev/numbers_and_words/pull/197)\] \([@franta](https://github.com/Franta1205)\)
|
10
|
+
* Upgrade RuboCop to 1.63.5. \[[#198](https://github.com/kslazarev/numbers_and_words/pull/198)\]
|
11
|
+
* Drop support for Ruby 2.7. \[[#202](https://github.com/kslazarev/numbers_and_words/pull/202)\]
|
12
|
+
* Drop support for Ruby 3.0. \[[#202](https://github.com/kslazarev/numbers_and_words/pull/202)\]
|
13
|
+
* Add support for Ruby 3.3. \[[#202](https://github.com/kslazarev/numbers_and_words/pull/202)\]
|
14
|
+
|
15
|
+
## 0.11.12 (April 22, 2023)
|
16
|
+
|
17
|
+
### Features
|
18
|
+
* Add support for Ruby 3.1. \[[#187](https://github.com/kslazarev/numbers_and_words/pull/187)\]
|
19
|
+
* Drop support for Ruby 2.5. \[[#180](https://github.com/kslazarev/numbers_and_words/pull/180)\]
|
20
|
+
* Drop support for Ruby 2.6. \[[#190](https://github.com/kslazarev/numbers_and_words/pull/190)\]
|
21
|
+
* Add support for Ruby 3.2. \[[#193](https://github.com/kslazarev/numbers_and_words/pull/193)\]
|
22
|
+
|
23
|
+
### Bugs
|
24
|
+
* Properly handle Dutch year numbers. \[[#183](https://github.com/kslazarev/numbers_and_words/pull/183)\] \([@mvz](https://github.com/mvz)\)
|
25
|
+
* Remove pluralization rules for French. \[[#195](https://github.com/kslazarev/numbers_and_words/pull/195)\]
|
26
|
+
|
27
|
+
## 0.11.11 (July 5, 2021)
|
28
|
+
|
29
|
+
### Bugs
|
30
|
+
* Fix edge cases in Dutch. \[[#182](https://github.com/kslazarev/numbers_and_words/pull/182)\] \([@mvz](https://github.com/mvz)\)
|
31
|
+
|
32
|
+
## 0.11.10 (January 5, 2021)
|
33
|
+
|
34
|
+
### Bugs
|
35
|
+
* Avoid adding all array extensions to the standard Array class. \[[#179](https://github.com/kslazarev/numbers_and_words/pull/179)\]
|
36
|
+
|
37
|
+
## 0.11.9 (January 4, 2021)
|
38
|
+
|
39
|
+
### Features
|
40
|
+
* Add support for Ruby 3.0. \[[#178](https://github.com/kslazarev/numbers_and_words/pull/178)\]
|
41
|
+
|
42
|
+
## 0.11.8 (June 6, 2020)
|
43
|
+
|
44
|
+
### Features
|
45
|
+
* Add support for Kazakh language. \[[#175](https://github.com/kslazarev/numbers_and_words/pull/175)\] \([@j8sus](https://github.com/j8sus)\)
|
46
|
+
|
47
|
+
## 0.11.7 (June 1, 2020)
|
48
|
+
|
49
|
+
### Features
|
50
|
+
* Add support for Ruby 2.7. \[[#172](https://github.com/kslazarev/numbers_and_words/pull/172)\]
|
51
|
+
* Drop support for Ruby 2.4.
|
52
|
+
|
53
|
+
## 0.11.6 (April 14, 2019)
|
54
|
+
|
55
|
+
### Bugs
|
56
|
+
* Fix wrong spelling in Spanish with precision. \[[#165](https://github.com/kslazarev/numbers_and_words/pull/165)\]
|
57
|
+
|
58
|
+
### Features
|
59
|
+
* Add support for Ruby 2.6. \[[#161](https://github.com/kslazarev/numbers_and_words/pull/161)\]
|
60
|
+
* Drop support for Ruby 2.2.
|
61
|
+
* Drop support for Ruby 2.3.
|
62
|
+
|
63
|
+
## 0.11.5 (March 22, 2018)
|
64
|
+
|
65
|
+
### Bugs
|
66
|
+
* Fix Armenian megs capacity words. \[[#156](https://github.com/kslazarev/numbers_and_words/pull/156)\]
|
67
|
+
|
68
|
+
## 0.11.4 (March 20, 2018)
|
69
|
+
|
70
|
+
### Features
|
71
|
+
* Add support for Armenian language. \[[#155](https://github.com/kslazarev/numbers_and_words/pull/155)\]
|
72
|
+
* Improve CI.
|
73
|
+
* Improve code readability.
|
74
|
+
|
75
|
+
## 0.11.3 (December 3, 2017)
|
76
|
+
|
77
|
+
### Features
|
78
|
+
* Add support for Vietnamese language. \[[#152](https://github.com/kslazarev/numbers_and_words/pull/152)\]
|
79
|
+
|
80
|
+
## 0.11.2 (August 14, 2017)
|
81
|
+
|
82
|
+
### Features
|
83
|
+
* Add full support for Czech language. \[[#148](https://github.com/kslazarev/numbers_and_words/pull/148)\]
|
84
|
+
|
85
|
+
## 0.11.1 (July 23, 2017)
|
86
|
+
|
87
|
+
### Features
|
88
|
+
* Add support for Spanish floating-point numbers. \[[#146](https://github.com/kslazarev/numbers_and_words/pull/146)\]
|
89
|
+
* Add support for French floating-point numbers. \[[#144](https://github.com/kslazarev/numbers_and_words/pull/144)\]
|
90
|
+
|
91
|
+
## 0.11.0 (June 26, 2017)
|
92
|
+
|
93
|
+
### Features
|
94
|
+
* Remove dependency on `ActiveSupport` gem. \[[#141](https://github.com/kslazarev/numbers_and_words/pull/141)\]
|
95
|
+
|
96
|
+
## 0.10.6 (June 11, 2017)
|
97
|
+
|
98
|
+
### Features
|
99
|
+
* Add full support for Brazilian Portuguese. \[[#139](https://github.com/kslazarev/numbers_and_words/pull/139)\]
|
100
|
+
* Add option `precision` to `to_words`. \[[#134](https://github.com/kslazarev/numbers_and_words/issues/134)\] \([@neodelf](https://github.com/neodelf)\) \(assignee: [@neodelf](https://github.com/neodelf)\)
|
101
|
+
|
102
|
+
### Bugs
|
103
|
+
* Fix README typo for 231 in French. \(assignee: [@poilon](https://github.com/poilon)\)
|
104
|
+
* Fix big numbers in Spanish. \[[#129](https://github.com/kslazarev/numbers_and_words/pull/129)\] \([@jlduran](https://github.com/jlduran)\) \(assignee: [@jlduran](https://github.com/jlduran)\)
|
105
|
+
* Fix typo for number twenty-one in Spanish. \[[#127](https://github.com/kslazarev/numbers_and_words/pull/127)\] \([@jlduran](https://github.com/jlduran)\) \(assignee: [@jlduran](https://github.com/jlduran)\)
|
106
|
+
|
107
|
+
## 0.10.5 (March 9, 2016)
|
108
|
+
|
109
|
+
### Bugs
|
110
|
+
* Fix pluralization rules for Spanish. \[[#122](https://github.com/kslazarev/numbers_and_words/pull/122)\] \([@jlduran](https://github.com/jlduran)\)
|
111
|
+
* Fix long scale names in Spanish. \[[#112](https://github.com/kslazarev/numbers_and_words/pull/112)\] \([@jlduran](https://github.com/jlduran)\)
|
112
|
+
* Fix Turkish hundred and thousand numbers. \[[#113](https://github.com/kslazarev/numbers_and_words/pull/113)\] \([@cbilgili](https://github.com/cbilgili)\)
|
113
|
+
* Fix one/other convention in Spanish and French. \[[#116](https://github.com/kslazarev/numbers_and_words/pull/116)\] \([@joseramonc](https://github.com/joseramonc)\)
|
114
|
+
* Fix hundreds in Lithuanian. \[[#117](https://github.com/kslazarev/numbers_and_words/pull/117)\] \([@osegrums](https://github.com/osegrums)\)
|
115
|
+
|
116
|
+
## 0.10.4 (March 02, 2015)
|
117
|
+
|
118
|
+
### Bugs
|
119
|
+
* Fix Lithuanian `other` spelling errors. \[[#109](https://github.com/kslazarev/numbers_and_words/pull/109)\] \([@ViliusLuneckas](https://github.com/ViliusLuneckas)\) \(assignee: [@miks](https://github.com/miks)\)
|
120
|
+
|
121
|
+
## 0.10.3 (May 8, 2014)
|
122
|
+
|
123
|
+
### Features
|
124
|
+
* Add Georgian language. \[[#100](https://github.com/kslazarev/numbers_and_words/pull/100)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)
|
125
|
+
|
126
|
+
### Bugs
|
127
|
+
* Simplify estonian tens with ones method. \[[#101](https://github.com/kslazarev/numbers_and_words/pull/101)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)
|
128
|
+
|
129
|
+
## 0.10.2 (December 18, 2013)
|
130
|
+
|
131
|
+
### Bugs
|
132
|
+
* Fix latvian one thousand case. \[[#88](https://github.com/kslazarev/numbers_and_words/pull/88)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)
|
133
|
+
|
134
|
+
### Supports
|
135
|
+
* Reach 100% coverage. \[[#89](https://github.com/kslazarev/numbers_and_words/pull/89)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)
|
136
|
+
|
137
|
+
## 0.10.1 (October 22, 2013)
|
138
|
+
|
139
|
+
### Bugs
|
140
|
+
* Minor orthographic typo in Spanish language. \[[#85](https://github.com/kslazarev/numbers_and_words/pull/85)\] \([@jlduran](https://github.com/jlduran)\) \(assignee: [@jlduran](https://github.com/jlduran)\)
|
141
|
+
|
142
|
+
## 0.10.0 (September 03, 2013)
|
143
|
+
|
144
|
+
### Features
|
145
|
+
* Add Estonian language. \[[#82](https://github.com/kslazarev/numbers_and_words/pull/82)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)
|
146
|
+
* Add Lithuanian language. \[[#77](https://github.com/kslazarev/numbers_and_words/pull/77)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)
|
147
|
+
|
148
|
+
### Bugs
|
149
|
+
* Fix latvian one hundread cases. \[[#81](https://github.com/kslazarev/numbers_and_words/pull/81)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)
|
150
|
+
|
151
|
+
### Supports
|
152
|
+
* Added @miks contacts to contributors list in README. \[[#79](https://github.com/kslazarev/numbers_and_words/issues/79)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@miks](https://github.com/miks)\)
|
153
|
+
|
154
|
+
## 0.9.0 (May 19, 2013)
|
155
|
+
|
156
|
+
### Features
|
157
|
+
* Add Latvian language. \[[#70](https://github.com/kslazarev/numbers_and_words/pull/70)\] \([@martinsspringis](https://github.com/martinsspringis)\) \(assignee: [@martinsspringis](https://github.com/martinsspringis)\)
|
158
|
+
* Add German language. \[[#52](https://github.com/kslazarev/numbers_and_words/pull/52)\] \([@GSI](https://github.com/GSI)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
159
|
+
|
160
|
+
### Supports
|
161
|
+
* Add @martinsspringis contacts and some examples on Latvian language to README. \[[#71](https://github.com/kslazarev/numbers_and_words/issues/71)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@martinsspringis](https://github.com/martinsspringis)\)
|
162
|
+
|
163
|
+
## 0.8.0 (April 29, 2013)
|
164
|
+
|
165
|
+
### Features
|
166
|
+
* Try to use global language by default, if regional language is missing (EnUs is missing). \[[#65](https://github.com/kslazarev/numbers_and_words/issues/65)\] \([@hubrix](https://github.com/hubrix)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
167
|
+
|
168
|
+
### Supports
|
169
|
+
* Add regional languages aliases to README. \[[#67](https://github.com/kslazarev/numbers_and_words/issues/67)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
170
|
+
* Remove all warnings in gem. (ruby -w). \[[#66](https://github.com/kslazarev/numbers_and_words/pull/66)\] \([@nikhaldi](https://github.com/nikhaldi)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
171
|
+
|
172
|
+
## 0.7.1 (April 22, 2013)
|
173
|
+
|
174
|
+
### Bugs
|
175
|
+
* Wrong hundreds separator with British. \[[#62](https://github.com/kslazarev/numbers_and_words/issues/62)\] \([@eLod](https://github.com/eLod)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
176
|
+
|
177
|
+
## 0.7.0 (April 14, 2013)
|
178
|
+
|
179
|
+
### Features
|
180
|
+
* Send number's options through array. \[[#60](https://github.com/kslazarev/numbers_and_words/issues/60)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
181
|
+
* Add British English. \[[#57](https://github.com/kslazarev/numbers_and_words/issues/57)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@eLod](https://github.com/eLod)\)
|
182
|
+
|
183
|
+
## 0.6.1 (April 11, 2013)
|
184
|
+
|
185
|
+
### Bugs
|
186
|
+
* Extra 'and' added after round hundreds (using hundreds_with_union: true) in English. \[[#58](https://github.com/kslazarev/numbers_and_words/issues/58)\] \([@mafraba](https://github.com/mafraba)\) \(assignee: [@eLod](https://github.com/eLod)\)
|
187
|
+
|
188
|
+
## 0.6.0 (March 25, 2013)
|
189
|
+
|
190
|
+
### Features
|
191
|
+
* Support fractional form for Ukranian. \[[#54](https://github.com/kslazarev/numbers_and_words/issues/54)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@Shk-Serji](https://github.com/Shk-Serji)\)
|
192
|
+
* Support fractional form for Russian. \[[#53](https://github.com/kslazarev/numbers_and_words/issues/53)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
193
|
+
* Added functionality for spanish . \[[#51](https://github.com/kslazarev/numbers_and_words/pull/51)\] \([@jaambros](https://github.com/jaambros)\) \(assignee: [@jaambros](https://github.com/jaambros)\)
|
194
|
+
* Support ordinal form for English and Hungarian. \[[#50](https://github.com/kslazarev/numbers_and_words/issues/50)\] \([@eLod](https://github.com/eLod)\) \(assignee: [@eLod](https://github.com/eLod)\)
|
195
|
+
* Add option :remove_hyphen for English language. \[[#45](https://github.com/kslazarev/numbers_and_words/issues/45)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
196
|
+
* Add option :hundreds_with_union for English language. \[[#44](https://github.com/kslazarev/numbers_and_words/issues/44)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
197
|
+
* Add Spanish language. (experimental). \[[#42](https://github.com/kslazarev/numbers_and_words/issues/42)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
198
|
+
* Add Swedish language. (experimental). \[[#41](https://github.com/kslazarev/numbers_and_words/issues/41)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
199
|
+
* Add Hungarian language. \[[#40](https://github.com/kslazarev/numbers_and_words/pull/40)\] \([@eLod](https://github.com/eLod)\) \(assignee: [@eLod](https://github.com/eLod)\)
|
200
|
+
* Add option :gender for Russian language. \[[#39](https://github.com/kslazarev/numbers_and_words/issues/39)\] \([@ermolaev](https://github.com/ermolaev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
201
|
+
* Gem numbers_and_words not working for decimal values. \[[#38](https://github.com/kslazarev/numbers_and_words/issues/38)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@eLod](https://github.com/eLod)\)
|
202
|
+
|
203
|
+
### Supports
|
204
|
+
* Update 'code climate' badge. \[[#47](https://github.com/kslazarev/numbers_and_words/issues/47)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
205
|
+
* Add @eLog contacts and project description on Hungarian language to README. \[[#46](https://github.com/kslazarev/numbers_and_words/issues/46)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@eLod](https://github.com/eLod)\)
|
206
|
+
* Add language specific options. \[[#43](https://github.com/kslazarev/numbers_and_words/issues/43)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
207
|
+
|
208
|
+
## 0.5.0 (October 19, 2012)
|
209
|
+
|
210
|
+
### Features
|
211
|
+
* Add Italian language. (experimental). \[[#34](https://github.com/kslazarev/numbers_and_words/issues/34)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
212
|
+
* Add Dutch language. (experimental). \[[#33](https://github.com/kslazarev/numbers_and_words/issues/33)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
213
|
+
* Add French language. \[[#29](https://github.com/kslazarev/numbers_and_words/pull/29)\] \([@sorich87](https://github.com/sorich87)\) \(assignee: [@sorich87](https://github.com/sorich87)\)
|
214
|
+
|
215
|
+
### Supports
|
216
|
+
* Add @sorich87 contacts to README. \[[#36](https://github.com/kslazarev/numbers_and_words/issues/36)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@sorich87](https://github.com/sorich87)\)
|
217
|
+
* Add Code Climate badge. \[[#35](https://github.com/kslazarev/numbers_and_words/issues/35)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
218
|
+
* Refactoring tests. \[[#32](https://github.com/kslazarev/numbers_and_words/issues/32)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
219
|
+
* Refactoring strategies. \[[#31](https://github.com/kslazarev/numbers_and_words/issues/31)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
220
|
+
|
221
|
+
## 0.4.0 (June 24, 2012)
|
222
|
+
|
223
|
+
### Features
|
224
|
+
* Add Turkish language. \[[#26](https://github.com/kslazarev/numbers_and_words/issues/26)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@Shk-Serji](https://github.com/Shk-Serji)\)
|
225
|
+
* Add Ukrainian language. \[[#25](https://github.com/kslazarev/numbers_and_words/issues/25)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@Shk-Serji](https://github.com/Shk-Serji)\)
|
226
|
+
|
227
|
+
### Supports
|
228
|
+
* Combine all connections with i18n library in one sub-module. \[[#28](https://github.com/kslazarev/numbers_and_words/issues/28)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
229
|
+
* Add separate logics for pluralization in different languages. \[[#27](https://github.com/kslazarev/numbers_and_words/issues/27)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
230
|
+
|
231
|
+
## 0.3.2 (June 24, 2012)
|
232
|
+
|
233
|
+
### Bugs
|
234
|
+
* Ломает плюрализацию russian. \[[#22](https://github.com/kslazarev/numbers_and_words/issues/22)\] \([@yura](https://github.com/yura)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
235
|
+
|
236
|
+
## 0.3.1 (May 04, 2012)
|
237
|
+
|
238
|
+
### Bugs
|
239
|
+
* Fixes 80 in English. \[[#18](https://github.com/kslazarev/numbers_and_words/pull/18)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
240
|
+
|
241
|
+
### Supports
|
242
|
+
* Add CHANGELOG.md. \[[#19](https://github.com/kslazarev/numbers_and_words/issues/19)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
243
|
+
* Readable specs. \[[#16](https://github.com/kslazarev/numbers_and_words/pull/16)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
244
|
+
|
245
|
+
### Deprecations
|
246
|
+
* Add deprecation warning for using gem 'number_to_words_ru' . \[[#21](https://github.com/kslazarev/numbers_and_words/issues/21)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
247
|
+
|
248
|
+
## 0.3.0 (March 24, 2012)
|
249
|
+
|
250
|
+
### Bugs
|
251
|
+
* Rails 3 will choke on a nested array. \[[#10](https://github.com/kslazarev/numbers_and_words/pull/10)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
252
|
+
* English fixes and tests. \[[#9](https://github.com/kslazarev/numbers_and_words/pull/9)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
253
|
+
* Namespaced NumbersAndWords. \[[#7](https://github.com/kslazarev/numbers_and_words/pull/7)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
254
|
+
|
255
|
+
### Supports
|
256
|
+
* Add contacts to README. \[[#14](https://github.com/kslazarev/numbers_and_words/issues/14)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
257
|
+
* Fixed typo in readme. \[[#13](https://github.com/kslazarev/numbers_and_words/pull/13)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
258
|
+
* Added Travis-ci. \[[#12](https://github.com/kslazarev/numbers_and_words/pull/12)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
259
|
+
* Fix README (Russian & English). \[[#11](https://github.com/kslazarev/numbers_and_words/pull/11)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
260
|
+
* Rename the repo at https://github.com/kslazarev/number_to_words_ru. \[[#8](https://github.com/kslazarev/numbers_and_words/issues/8)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
261
|
+
* Switch a hard-coded gemspec to Jeweler. \[[#6](https://github.com/kslazarev/numbers_and_words/pull/6)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@dblock](https://github.com/dblock)\)
|
262
|
+
|
263
|
+
## 0.3.0.alpha (March 24, 2012)
|
264
|
+
|
265
|
+
### Features
|
266
|
+
* Check working with ruby 1.9.3. \[[#4](https://github.com/kslazarev/numbers_and_words/issues/4)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
267
|
+
|
268
|
+
### Bugs
|
269
|
+
* Bundle exec rake problem. \[[#3](https://github.com/kslazarev/numbers_and_words/issues/3)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
270
|
+
|
271
|
+
### Supports
|
272
|
+
* Remove temporary file Gemfile.lock. \[[#5](https://github.com/kslazarev/numbers_and_words/issues/5)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
273
|
+
* Renamed gem from number_to_words_ru to numbers_and_words. \[[#2](https://github.com/kslazarev/numbers_and_words/pull/2)\] \([@dblock](https://github.com/dblock)\) \(assignee: [@kslazarev](https://github.com/kslazarev)\)
|
data/README.rdoc
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
== numbers_and_words
|
2
2
|
|
3
|
-
{
|
4
|
-
{
|
5
|
-
{
|
6
|
-
{
|
3
|
+
{rdoc-image:https://badge.fury.io/rb/numbers_and_words.svg?branch=master}[https://badge.fury.io/rb/numbers_and_words]
|
4
|
+
{rdoc-image:https://codeclimate.com/github/kslazarev/numbers_and_words.svg?branch=master}[https://codeclimate.com/github/kslazarev/numbers_and_words]
|
5
|
+
{rdoc-image:https://github.com/kslazarev/numbers_and_words/actions/workflows/ci.yml/badge.svg?branch=master}[https://github.com/kslazarev/numbers_and_words/actions/workflows/ci.yml]
|
6
|
+
{rdoc-image:https://coveralls.io/repos/kslazarev/numbers_and_words/badge.svg?branch=master}[https://coveralls.io/r/kslazarev/numbers_and_words]
|
7
7
|
|
8
8
|
Spell out numbers in several languages using the I18n gem.
|
9
9
|
|
@@ -42,6 +42,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
42
42
|
* Português Brasileiro [pt-BR]
|
43
43
|
* հայերեն (Armenian) [hy]
|
44
44
|
* Қазақша [kz]
|
45
|
+
* Dansk [da]
|
45
46
|
|
46
47
|
** Experimental
|
47
48
|
|
@@ -93,6 +94,9 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
93
94
|
I18n.with_locale(:kz) { 42.to_words }
|
94
95
|
=> "қырық екi"
|
95
96
|
|
97
|
+
I18n.with_locale(:da) { 42.to_words }
|
98
|
+
=> "toogfyrre"
|
99
|
+
|
96
100
|
21.to_words
|
97
101
|
=> "twenty-one"
|
98
102
|
=> "veintiuno"
|
@@ -114,6 +118,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
114
118
|
=> "hai mươi mốt"
|
115
119
|
=> "քսան մեկ"
|
116
120
|
=> "жиырма бiр"
|
121
|
+
=> "enogtyve"
|
117
122
|
|
118
123
|
231.to_words
|
119
124
|
=> "two hundred thirty-one"
|
@@ -136,6 +141,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
136
141
|
=> "hai trăm ba mươi mốt"
|
137
142
|
=> "երկու հարյուր երեսուն մեկ"
|
138
143
|
=> "екi жүз отыз бiр"
|
144
|
+
=> "to hundrede enogtredive"
|
139
145
|
|
140
146
|
4030.to_words
|
141
147
|
=> "four thousand thirty"
|
@@ -157,6 +163,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
157
163
|
=> "bốn nghìn không trăm ba mươi"
|
158
164
|
=> "չորս հազար երեսուն"
|
159
165
|
=> "төрт мың отыз"
|
166
|
+
=> "fire tusinde tredive"
|
160
167
|
|
161
168
|
1000100.to_words
|
162
169
|
=> "one million one hundred"
|
@@ -178,6 +185,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
178
185
|
=> "một triệu một trăm"
|
179
186
|
=> "մեկ միլիոն հարյուր"
|
180
187
|
=> "бiр миллион бiр жүз"
|
188
|
+
=> "en million et hundrede"
|
181
189
|
|
182
190
|
1000000000000000000000000000000000.to_words
|
183
191
|
=> "one decillion"
|
@@ -211,6 +219,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
211
219
|
=> ["một", "hai", "ba"]
|
212
220
|
=> ["մեկ", "երկու", "երեք"]
|
213
221
|
=> ["бiр", "екi", "үш"]
|
222
|
+
=> ["et", "to", "tre"]
|
214
223
|
|
215
224
|
[11, 22, 133].to_words
|
216
225
|
=> ["eleven", "twenty-two", "one hundred thirty-three"]
|
@@ -232,6 +241,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
232
241
|
=> ["mười một", "hai mươi hai", "một trăm ba mươi ba"]
|
233
242
|
=> ["տասնմեկ", "քսան երկու", "հարյուր երեսուն երեք"]
|
234
243
|
=> ["он бiр", "жиырма екi", "бiр жүз отыз үш"]
|
244
|
+
=> ["elleve", "toogtyve", "et hundrede treogtredive"]
|
235
245
|
|
236
246
|
21.77.to_words
|
237
247
|
=> "twenty-one and seventy-seven hundredths"
|
@@ -353,6 +363,16 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
353
363
|
I18n.with_locale(:es) { 0.7.to_words remove_zero: true }
|
354
364
|
=> "siete décimas"
|
355
365
|
|
366
|
+
* Danish
|
367
|
+
|
368
|
+
Change gender from: (gender: [:neuter || :common])
|
369
|
+
|
370
|
+
I18n.with_locale(:da) { 1.to_words gender: :common }
|
371
|
+
=> "en"
|
372
|
+
|
373
|
+
I18n.with_locale(:da) { 1.to_words gender: :neuter }
|
374
|
+
=> "et"
|
375
|
+
|
356
376
|
== Other options / Другие опции
|
357
377
|
|
358
378
|
* Precision
|
@@ -367,8 +387,8 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
367
387
|
|
368
388
|
== Requirements / Требования / Configuration Requise
|
369
389
|
|
370
|
-
*
|
371
|
-
*
|
390
|
+
* 3.1 <= Ruby (compatible with/совместимость с/compatible avec Ruby 3.1 and/и/et JRuby);
|
391
|
+
* 1.14.3 <= I18n (earlier versions not tested/ранние версии не тестировались/versions précédentes non testées);
|
372
392
|
|
373
393
|
== Installation / Установка / Installation
|
374
394
|
|
@@ -8,8 +8,8 @@ module NumbersAndWords
|
|
8
8
|
local_language { Strategies.array_joiner.new(to_a, options).run }
|
9
9
|
end
|
10
10
|
|
11
|
-
def local_language(&
|
12
|
-
::I18n.with_locale(I18n.local_language, &
|
11
|
+
def local_language(&)
|
12
|
+
::I18n.with_locale(I18n.local_language, &)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
da:
|
2
|
+
numbers:
|
3
|
+
ones: [nul, et, to, tre, fire, fem, seks, syv, otte, ni]
|
4
|
+
common: [nul, en, to, tre, fire, fem, seks, syv, otte, ni]
|
5
|
+
neuter: [nul, et, to, tre, fire, fem, seks, syv, otte, ni]
|
6
|
+
teens: [_, elleve, tolv, tretten, fjorten, femten, seksten, sytten, atten, nitten]
|
7
|
+
tens: [_, ti, tyve, tredive, fyrre, halvtreds, tres, halvfjerds, firs, halvfems]
|
8
|
+
hundreds: [ _, et hundrede, to hundrede, tre hundrede, fire hundrede, fem hundrede, seks hundrede, syv hundrede, otte hundrede, ni hundrede ]
|
9
|
+
one_hundred: et hundrede
|
10
|
+
mega: [_, tusinde, million, milliard, billion, billiard, trillion]
|
11
|
+
tusinde:
|
12
|
+
one: tusinde
|
13
|
+
other: tusinde
|
14
|
+
million:
|
15
|
+
one: million
|
16
|
+
other: millioner
|
17
|
+
milliard:
|
18
|
+
one: milliard
|
19
|
+
other: milliarder
|
20
|
+
billion:
|
21
|
+
one: billion
|
22
|
+
other: billioner
|
23
|
+
billiard:
|
24
|
+
one: billiard
|
25
|
+
other: billiarder
|
26
|
+
trillion:
|
27
|
+
one: trillion
|
28
|
+
other: trillioner
|
29
|
+
ordinal:
|
30
|
+
ones: [nulte, første, anden, tredje, fjerde, femte, sjette, syvende, ottende, niende]
|
31
|
+
teens: [tiende, ellevte, tolvte, trettende, fjortende, femtende, sekstende, syttende, attende, nittende]
|
32
|
+
tens: [_, tiende, tyvende, tredive, fyrre, halvtreds, tres, halvfjerds, firs, halvfems]
|
33
|
+
hundreds: hundredende
|
34
|
+
micro: [_, tiendedele, hundrededele, tusindedele, milliontedele]
|
35
|
+
tenths:
|
36
|
+
one: tiendedel
|
37
|
+
other: tiendedele
|
38
|
+
hundredths:
|
39
|
+
one: hundrededel
|
40
|
+
other: hundrededele
|
41
|
+
thousandths:
|
42
|
+
one: tusindedel
|
43
|
+
other: tusindedele
|
44
|
+
millionths:
|
45
|
+
one: milliontedel
|
46
|
+
other: milliontedele
|
47
|
+
micro_separator: og
|
48
|
+
micro_prefix:
|
49
|
+
tens: ti
|
50
|
+
hundreds: hundrede
|
51
|
+
union: '-'
|
52
|
+
union: og
|
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'numbers_and_words/i18n/plurals/cs'
|
4
4
|
require 'numbers_and_words/i18n/plurals/ru'
|
5
5
|
require 'numbers_and_words/i18n/plurals/ua'
|
6
|
-
require 'numbers_and_words/i18n/plurals/fr'
|
7
6
|
require 'numbers_and_words/i18n/plurals/lv'
|
8
7
|
require 'numbers_and_words/i18n/plurals/lt'
|
9
8
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
NumbersAndWords::I18n::Pluralization.languages.
|
3
|
+
NumbersAndWords::I18n::Pluralization.languages.to_h do |language|
|
4
4
|
[language.to_sym, {
|
5
5
|
i18n: {
|
6
6
|
plural: {
|
@@ -8,4 +8,4 @@ NumbersAndWords::I18n::Pluralization.languages.map do |language|
|
|
8
8
|
}
|
9
9
|
}
|
10
10
|
}]
|
11
|
-
end
|
11
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NumbersAndWords
|
4
|
+
module Strategies
|
5
|
+
module FiguresConverter
|
6
|
+
module Languages
|
7
|
+
class Da < Base
|
8
|
+
def print_words
|
9
|
+
complex_part.count > 1 ? print_megs_words : @strings.flatten.reverse.join(' ')
|
10
|
+
end
|
11
|
+
|
12
|
+
def ones
|
13
|
+
super({ gender: })
|
14
|
+
end
|
15
|
+
|
16
|
+
def hundreds
|
17
|
+
super({ is_hundred: hundred?, is_one_hundred: one_hundred? })
|
18
|
+
end
|
19
|
+
|
20
|
+
def megs
|
21
|
+
super({ number: @figures.number_in_capacity(@current_capacity) })
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def simple_part
|
27
|
+
@strings.reject { |f| f.is_a?(Array) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def complex_part
|
31
|
+
@strings - simple_part
|
32
|
+
end
|
33
|
+
|
34
|
+
def hundred?
|
35
|
+
figures[0].zero? && figures[1].zero? && simple_number_to_words.empty?
|
36
|
+
end
|
37
|
+
|
38
|
+
def one_hundred?
|
39
|
+
hundred? && figures[2] == 1
|
40
|
+
end
|
41
|
+
|
42
|
+
def gender
|
43
|
+
@current_capacity ||= 0
|
44
|
+
if @current_capacity.zero?
|
45
|
+
@options.gender.result
|
46
|
+
elsif @current_capacity == 1
|
47
|
+
:neuter
|
48
|
+
else
|
49
|
+
:common
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -21,7 +21,7 @@ module NumbersAndWords
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def ones
|
24
|
-
super(postfix:
|
24
|
+
super(postfix:)
|
25
25
|
end
|
26
26
|
|
27
27
|
def postfix
|
@@ -39,8 +39,8 @@ module NumbersAndWords
|
|
39
39
|
private
|
40
40
|
|
41
41
|
def print_megs
|
42
|
-
complex_part[1
|
43
|
-
[el[1
|
42
|
+
complex_part[1..].map do |el|
|
43
|
+
[el[1..].to_a.reverse.join, el.first].join(' ')
|
44
44
|
end.reject(&:empty?).reverse.join(' ')
|
45
45
|
end
|
46
46
|
|
@@ -14,20 +14,20 @@ module NumbersAndWords
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def ones
|
17
|
-
super({ gender
|
17
|
+
super({ gender:,
|
18
18
|
is_one_thousand: one_thousand?,
|
19
19
|
is_apocopated: one_apocopated? })
|
20
20
|
end
|
21
21
|
|
22
22
|
def tens_with_ones
|
23
|
-
options = { gender
|
23
|
+
options = { gender:, is_apocopated: one_apocopated? }
|
24
24
|
return @translations.twenties_with_ones(@figures, options) if @figures.tens == 2
|
25
25
|
|
26
26
|
super(options)
|
27
27
|
end
|
28
28
|
|
29
29
|
def hundreds
|
30
|
-
super({ gender
|
30
|
+
super({ gender:,
|
31
31
|
is_apocopated: hundred_apocopated? })
|
32
32
|
end
|
33
33
|
|
@@ -52,7 +52,7 @@ module NumbersAndWords
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def one_apocopated?
|
55
|
-
@current_capacity.positive? && @figures.ones == 1 ||
|
55
|
+
(@current_capacity.positive? && @figures.ones == 1) ||
|
56
56
|
@options.apocopated.result
|
57
57
|
end
|
58
58
|
|
@@ -20,7 +20,7 @@ module NumbersAndWords
|
|
20
20
|
def megs
|
21
21
|
prefix = (:partials if @figures.hundreds || @figures.tens || @figures.ones)
|
22
22
|
|
23
|
-
super(prefix:
|
23
|
+
super(prefix:)
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
@@ -30,7 +30,7 @@ module NumbersAndWords
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def thousand?
|
33
|
-
FiguresArray::THOUSAND_CAPACITY
|
33
|
+
@current_capacity == FiguresArray::THOUSAND_CAPACITY
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -10,7 +10,8 @@ module NumbersAndWords
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def capacity_iteration
|
13
|
-
return super if FiguresArray::THOUSAND_CAPACITY
|
13
|
+
return super if @current_capacity != FiguresArray::THOUSAND_CAPACITY
|
14
|
+
return [] if apply_tens_of_hundreds?
|
14
15
|
return megs if figures.number_in_capacity(@current_capacity) == 1
|
15
16
|
|
16
17
|
capacity_words = words_in_capacity(@current_capacity)
|
@@ -24,6 +25,24 @@ module NumbersAndWords
|
|
24
25
|
super
|
25
26
|
end
|
26
27
|
end
|
28
|
+
|
29
|
+
def number_without_capacity_to_words
|
30
|
+
return super unless apply_tens_of_hundreds?
|
31
|
+
|
32
|
+
base = save_parent_figures do
|
33
|
+
@figures = @parent_figures[2, 2].to_figures
|
34
|
+
simple_number_to_words
|
35
|
+
end
|
36
|
+
[([base, translate(:hundreds, 1)] + simple_number_to_words).join]
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def apply_tens_of_hundreds?
|
42
|
+
@options.tens_of_hundreds.result &&
|
43
|
+
(1..9).cover?(figures.number_in_capacity(FiguresArray::THOUSAND_CAPACITY)) &&
|
44
|
+
figures.hundreds
|
45
|
+
end
|
27
46
|
end
|
28
47
|
end
|
29
48
|
end
|
@@ -20,7 +20,7 @@ module NumbersAndWords
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def complex_number_to_words
|
23
|
-
super.
|
23
|
+
super.compact
|
24
24
|
end
|
25
25
|
|
26
26
|
def capacity_iteration
|
@@ -31,11 +31,11 @@ module NumbersAndWords
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def ones
|
34
|
-
super
|
34
|
+
super(internal_options.merge(is_one_thousand: one_thousand?))
|
35
35
|
end
|
36
36
|
|
37
37
|
def hundreds
|
38
|
-
super(internal_options.merge(is_hundred: hundred?, is_one_hundred: one_hundred?, gender:
|
38
|
+
super(internal_options.merge(is_hundred: hundred?, is_one_hundred: one_hundred?, gender:))
|
39
39
|
end
|
40
40
|
|
41
41
|
def megs
|
@@ -48,7 +48,7 @@ module NumbersAndWords
|
|
48
48
|
private
|
49
49
|
|
50
50
|
def internal_options
|
51
|
-
{ gender
|
51
|
+
{ gender:, prefix: maybe_ordinal }
|
52
52
|
end
|
53
53
|
|
54
54
|
def maybe_ordinal
|
@@ -56,7 +56,7 @@ module NumbersAndWords
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def gender
|
59
|
-
return
|
59
|
+
return options.gender.result || :male if maybe_ordinal
|
60
60
|
|
61
61
|
if current_capacity&.positive? && figures[0] == 1
|
62
62
|
:male
|
@@ -23,6 +23,7 @@ require 'numbers_and_words/strategies/figures_converter/languages/se'
|
|
23
23
|
require 'numbers_and_words/strategies/figures_converter/languages/tr'
|
24
24
|
require 'numbers_and_words/strategies/figures_converter/languages/hy'
|
25
25
|
require 'numbers_and_words/strategies/figures_converter/languages/kz'
|
26
|
+
require 'numbers_and_words/strategies/figures_converter/languages/da'
|
26
27
|
|
27
28
|
require 'numbers_and_words/strategies/figures_converter/languages/families/cyrillic'
|
28
29
|
require 'numbers_and_words/strategies/figures_converter/languages/ru'
|
@@ -12,7 +12,7 @@ module NumbersAndWords
|
|
12
12
|
|
13
13
|
def result(type)
|
14
14
|
@type = type
|
15
|
-
|
15
|
+
type == MEGS_TYPE ? check_megs_numbers : check_simple_numbers
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
@@ -27,8 +27,8 @@ module NumbersAndWords
|
|
27
27
|
|
28
28
|
def simple_numbers_condition
|
29
29
|
current_capacity.nil? &&
|
30
|
-
(
|
31
|
-
|
30
|
+
(@type != HUNDRED_TYPE ||
|
31
|
+
(@type == HUNDRED_TYPE && simple_number_to_words.empty?))
|
32
32
|
end
|
33
33
|
|
34
34
|
def megs_numbers_condition
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NumbersAndWords
|
4
|
+
module Strategies
|
5
|
+
module FiguresConverter
|
6
|
+
module Options
|
7
|
+
module Nl
|
8
|
+
class TensOfHundreds
|
9
|
+
attr_accessor :strategy, :options
|
10
|
+
|
11
|
+
def initialize(proxy, *_args)
|
12
|
+
@strategy = proxy.strategy
|
13
|
+
@options = proxy.options
|
14
|
+
end
|
15
|
+
|
16
|
+
def result
|
17
|
+
active?
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def active?
|
23
|
+
@options[:tens_of_hundreds]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -5,10 +5,12 @@ require 'numbers_and_words/strategies/figures_converter/options/en'
|
|
5
5
|
require 'numbers_and_words/strategies/figures_converter/options/en-GB'
|
6
6
|
require 'numbers_and_words/strategies/figures_converter/options/es'
|
7
7
|
require 'numbers_and_words/strategies/figures_converter/options/hu'
|
8
|
+
require 'numbers_and_words/strategies/figures_converter/options/nl'
|
8
9
|
require 'numbers_and_words/strategies/figures_converter/options/pt-BR'
|
9
10
|
require 'numbers_and_words/strategies/figures_converter/options/ru'
|
10
11
|
require 'numbers_and_words/strategies/figures_converter/options/ua'
|
11
12
|
require 'numbers_and_words/strategies/figures_converter/options/cs'
|
13
|
+
require 'numbers_and_words/strategies/figures_converter/options/da'
|
12
14
|
|
13
15
|
module NumbersAndWords
|
14
16
|
module Strategies
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NumbersAndWords
|
4
|
+
module Translations
|
5
|
+
class Da < Base
|
6
|
+
include NumbersAndWords::Translations::Families::Base
|
7
|
+
|
8
|
+
DEFAULT_POSTFIX = nil
|
9
|
+
|
10
|
+
def ones(number, options = {})
|
11
|
+
return t(:common)[number] if options[:gender] == :common
|
12
|
+
return t(:neuter)[number] if options[:gender] == :neuter
|
13
|
+
|
14
|
+
t([options[:prefix], :ones, options[:postfix] || DEFAULT_POSTFIX].join('.'))[number]
|
15
|
+
end
|
16
|
+
|
17
|
+
def tens(number, _options = {})
|
18
|
+
t(:tens)[number]
|
19
|
+
end
|
20
|
+
|
21
|
+
def tens_with_ones(numbers, _options = {})
|
22
|
+
[ones(numbers[0], { gender: :common }), tens(numbers[1])].join(union)
|
23
|
+
end
|
24
|
+
|
25
|
+
def hundreds(number, options = {})
|
26
|
+
return t(:one_hundred) if options[:is_one_hundred]
|
27
|
+
return t(:hundreds)[number] if options[:is_hundred]
|
28
|
+
|
29
|
+
t(:hundreds)[number]
|
30
|
+
end
|
31
|
+
|
32
|
+
def zero(_options = {})
|
33
|
+
ones 0
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -11,19 +11,19 @@ module NumbersAndWords
|
|
11
11
|
def tens(number, options = {})
|
12
12
|
return t(:eighty) if number == SPECIAL_TENS_CASE && options[:alone].nil?
|
13
13
|
|
14
|
-
super
|
14
|
+
super
|
15
15
|
end
|
16
16
|
|
17
17
|
def tens_with_ones(numbers, options = {})
|
18
18
|
return [tens(numbers[1] - 1, alone: false), teens(numbers)].join('-') if [7, 9].include? numbers[1]
|
19
19
|
|
20
20
|
separator = numbers[0] == 1 ? " #{union} " : '-'
|
21
|
-
super
|
21
|
+
super(numbers, options.merge(separator:))
|
22
22
|
end
|
23
23
|
|
24
24
|
def hundreds(number, options = {})
|
25
25
|
count = options[:pluralize] ? number : 1
|
26
|
-
hundreds = t(:hundreds, count:
|
26
|
+
hundreds = t(:hundreds, count:)
|
27
27
|
|
28
28
|
return hundreds if number == 1
|
29
29
|
|
@@ -29,7 +29,7 @@ module NumbersAndWords
|
|
29
29
|
def teens(number, options = {})
|
30
30
|
return [tens(1, options), ones(number[0], options)].join(' ') if ordinal? options
|
31
31
|
|
32
|
-
super
|
32
|
+
super
|
33
33
|
end
|
34
34
|
|
35
35
|
def tens_with_ones(numbers, options = {})
|
@@ -48,10 +48,10 @@ module NumbersAndWords
|
|
48
48
|
|
49
49
|
def megs(capacity, options = {})
|
50
50
|
return t([options[:prefix], :mega, options[:gender]].join('.'))[capacity] if ordinal?(options)
|
51
|
-
return super
|
51
|
+
return super if options[:is_opaque] || options[:is_without_connector]
|
52
52
|
|
53
53
|
suffix = options[:is_with_comma] ? ',' : " #{union}"
|
54
|
-
super
|
54
|
+
super + suffix
|
55
55
|
end
|
56
56
|
|
57
57
|
def micros(capacity, number = nil)
|
@@ -27,6 +27,7 @@ require 'numbers_and_words/translations/cs'
|
|
27
27
|
require 'numbers_and_words/translations/vi'
|
28
28
|
require 'numbers_and_words/translations/hy'
|
29
29
|
require 'numbers_and_words/translations/kz'
|
30
|
+
require 'numbers_and_words/translations/da'
|
30
31
|
|
31
32
|
module NumbersAndWords
|
32
33
|
module Translations
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: numbers_and_words
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Lazarev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -57,9 +57,11 @@ email: k.s.lazarev@gmail.com
|
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
59
59
|
extra_rdoc_files:
|
60
|
+
- CHANGELOG.md
|
60
61
|
- LICENSE.txt
|
61
62
|
- README.rdoc
|
62
63
|
files:
|
64
|
+
- CHANGELOG.md
|
63
65
|
- LICENSE.txt
|
64
66
|
- README.rdoc
|
65
67
|
- lib/numbers_and_words.rb
|
@@ -74,6 +76,7 @@ files:
|
|
74
76
|
- lib/numbers_and_words/i18n.rb
|
75
77
|
- lib/numbers_and_words/i18n/initialization.rb
|
76
78
|
- lib/numbers_and_words/i18n/locales/numbers.cs.yml
|
79
|
+
- lib/numbers_and_words/i18n/locales/numbers.da.yml
|
77
80
|
- lib/numbers_and_words/i18n/locales/numbers.de.yml
|
78
81
|
- lib/numbers_and_words/i18n/locales/numbers.en-GB.yml
|
79
82
|
- lib/numbers_and_words/i18n/locales/numbers.en.yml
|
@@ -97,7 +100,6 @@ files:
|
|
97
100
|
- lib/numbers_and_words/i18n/locales/numbers.vi.yml
|
98
101
|
- lib/numbers_and_words/i18n/pluralization.rb
|
99
102
|
- lib/numbers_and_words/i18n/plurals/cs.rb
|
100
|
-
- lib/numbers_and_words/i18n/plurals/fr.rb
|
101
103
|
- lib/numbers_and_words/i18n/plurals/lt.rb
|
102
104
|
- lib/numbers_and_words/i18n/plurals/lv.rb
|
103
105
|
- lib/numbers_and_words/i18n/plurals/plurals.rb
|
@@ -164,6 +166,7 @@ files:
|
|
164
166
|
- lib/numbers_and_words/strategies/figures_converter/languages.rb
|
165
167
|
- lib/numbers_and_words/strategies/figures_converter/languages/base.rb
|
166
168
|
- lib/numbers_and_words/strategies/figures_converter/languages/cs.rb
|
169
|
+
- lib/numbers_and_words/strategies/figures_converter/languages/da.rb
|
167
170
|
- lib/numbers_and_words/strategies/figures_converter/languages/de.rb
|
168
171
|
- lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb
|
169
172
|
- lib/numbers_and_words/strategies/figures_converter/languages/en.rb
|
@@ -197,6 +200,8 @@ files:
|
|
197
200
|
- lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb
|
198
201
|
- lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb
|
199
202
|
- lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb
|
203
|
+
- lib/numbers_and_words/strategies/figures_converter/options/da.rb
|
204
|
+
- lib/numbers_and_words/strategies/figures_converter/options/da/gender.rb
|
200
205
|
- lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb
|
201
206
|
- lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb
|
202
207
|
- lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb
|
@@ -215,6 +220,8 @@ files:
|
|
215
220
|
- lib/numbers_and_words/strategies/figures_converter/options/es/remove_zero.rb
|
216
221
|
- lib/numbers_and_words/strategies/figures_converter/options/hu.rb
|
217
222
|
- lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb
|
223
|
+
- lib/numbers_and_words/strategies/figures_converter/options/nl.rb
|
224
|
+
- lib/numbers_and_words/strategies/figures_converter/options/nl/tens_of_hundreds.rb
|
218
225
|
- lib/numbers_and_words/strategies/figures_converter/options/pt-BR.rb
|
219
226
|
- lib/numbers_and_words/strategies/figures_converter/options/pt-BR/gender.rb
|
220
227
|
- lib/numbers_and_words/strategies/figures_converter/options/pt-BR/ordinal.rb
|
@@ -226,6 +233,7 @@ files:
|
|
226
233
|
- lib/numbers_and_words/translations.rb
|
227
234
|
- lib/numbers_and_words/translations/base.rb
|
228
235
|
- lib/numbers_and_words/translations/cs.rb
|
236
|
+
- lib/numbers_and_words/translations/da.rb
|
229
237
|
- lib/numbers_and_words/translations/de.rb
|
230
238
|
- lib/numbers_and_words/translations/en-GB.rb
|
231
239
|
- lib/numbers_and_words/translations/en.rb
|
@@ -267,14 +275,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
267
275
|
requirements:
|
268
276
|
- - ">="
|
269
277
|
- !ruby/object:Gem::Version
|
270
|
-
version:
|
278
|
+
version: 3.1.0
|
271
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
272
280
|
requirements:
|
273
281
|
- - ">="
|
274
282
|
- !ruby/object:Gem::Version
|
275
283
|
version: '0'
|
276
284
|
requirements: []
|
277
|
-
rubygems_version: 3.
|
285
|
+
rubygems_version: 3.5.19
|
278
286
|
signing_key:
|
279
287
|
specification_version: 4
|
280
288
|
summary: Spell out numbers in several languages
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NumbersAndWords
|
4
|
-
module I18n
|
5
|
-
module Plurals
|
6
|
-
module Fr
|
7
|
-
module_function
|
8
|
-
|
9
|
-
RULE = ->(number) { one_conditions(number) ? :one : :other }
|
10
|
-
|
11
|
-
def one_conditions(number)
|
12
|
-
number % 10 == 1 && number % 100 != 11
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|