You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each language has it's own unique grammar exceptions. You can create your own
102
-
language.json file in the folder "i18n" and give writtenNumber support for it. I
103
-
don't think the current scheme and logic cover all the cases, but may be cover
69
+
70
+
## Configure your own language
71
+
Each language has it's own unique grammar exceptions. You can create your own
72
+
language.json file in the folder "i18n" and give writtenNumber support for it. I
73
+
don't think the current scheme and logic cover all the cases, but may be cover
104
74
some.
105
75
106
76
##### useLongScale:
107
-
'Boolean' that indicates if it use [long or short
108
-
scale](http://en.wikipedia.org/wiki/Long_and_short_scales). This differs the
109
-
meaning of the words `billion`, `trillion` and so on.
77
+
'Boolean' that indicates if it use [long or short scale](http://en.wikipedia.org/wiki/Long_and_short_scales). This differs the meaning of the words `billion`, `trillion` and so on.
110
78
111
79
##### baseSeparator:
112
80
'String' that separates the base cardinal numbers.
@@ -116,9 +84,12 @@ Example: 29 -> twenty`-`eight. Spanish uses the conector " y ".
116
84
'String' that separates the units from the last base cardinal numbers.
117
85
Example: 1234 -> one thousand two hundred **and** thirty-four
118
86
87
+
##### allSeparator:
88
+
'String' that separates all cardinals, not only the last one.
89
+
Example: 1125 -> ألف **و**مائة **و**خمسة **و**عشرون
90
+
119
91
##### base:
120
-
Base cardinals numbers. Numbers that have unique names and are used to build
121
-
others.
92
+
Base cardinals numbers. Numbers that have unique names and are used to build others.
122
93
123
94
##### alternativeBase:
124
95
Alternative versions of base cardinals numbers for usage with specific units (ex. thousands in Ukrainian use feminine form of base cardinal numbers). These bases will be treated as an extension for the default `base`.
@@ -136,10 +107,7 @@ Alternative versions of base cardinals numbers for usage with specific units (ex
136
107
Number units.
137
108
It can be:
138
109
- String
139
-
140
-
- Object normal flow. Give support to singular and plural units. English does
141
-
not need this, but spanish does.
142
-
110
+
- Object normal flow. Give support to singular, dual, and plural units. English does not need this, but spanish does.
143
111
```json
144
112
{
145
113
"singular": "millón",
@@ -174,13 +142,13 @@ Selects an `alternativeBase` name which this unit should prefer over the default
174
142
}
175
143
```
176
144
145
+
177
146
- Object with `useBaseInstead` exception.
178
147
179
-
In some languages like spanish, specific units like "ciento", use the base
180
-
cardinal number instead.
148
+
In some languages like spanish and arabic, specific units like "ciento", use the base cardinal number instead.
181
149
182
-
With `useBaseException` you can also specify with which unit (1 to 9) you don't
183
-
want use the base cardinal instead and use the regular behaviour.
150
+
- Object with `useBaseException`: You can also specify with which unit (1 to 9) you don't
151
+
want use the base cardinal instead and use the regular behaviour:
184
152
185
153
```json
186
154
{
@@ -189,32 +157,27 @@ want use the base cardinal instead and use the regular behaviour.
189
157
"useBaseException": [1]
190
158
}
191
159
```
192
-
193
-
- Object with `avoidPrefixException` exception.
194
-
160
+
- Object with `avoidPrefixException` exception:
195
161
In some languages like spanish, specific units like "mil" does not use the base
196
162
cardinal number prefix for unit 1.
197
-
198
163
```json
199
164
{
200
165
"singular": "mil",
201
166
"avoidPrefixException": [1]
202
167
}
203
168
```
204
-
205
-
206
169
- Object with `avoidInNumberPlural` exception.
207
-
208
170
In some languages like french, specific units like "cent" does not use the plural form inside of
209
171
numbers wioth trailing numbers other than 0, for example "deux cents" and "deux cent trois".
210
-
211
172
```json
212
173
{
213
174
"singular": "cent",
214
175
"plural": "cents",
215
176
"avoidInNumberPlural": true
216
177
}
217
178
```
179
+
- Object with `restrictedPlural` boolean:
180
+
If plural is used only for numbers from 3 to 10 , but the singular form is used if the number is older than 11.
218
181
219
182
- Object with `useSingularEnding` exception and `useFewEnding` exception.
220
183
@@ -234,85 +197,14 @@ In some languages like Ukrainian, singular form of the unit is also used for any
234
197
##### unitExceptions:
235
198
Sometimes grammar exceptions affect the base cardinal joined to the unit. You
236
199
can set specific exceptions to any base cardinal number.
237
-
238
200
Spanish example:
239
-
240
201
```
241
202
Without Exception (Wrong): 1232000 -> **uno** millón doscientos treinta y dos mil
242
-
```
243
-
244
-
```
245
203
With Exception: 1232000 -> **un** millón doscientos treinta y dos mil
246
204
```
247
205
248
-
### English configuration example
249
-
```json
250
-
{
251
-
"useLongScale": false,
252
-
"baseSeparator": "-",
253
-
"unitSeparator": "and ",
254
-
"base": {
255
-
"0": "zero",
256
-
"1": "one",
257
-
"2": "two",
258
-
"3": "three",
259
-
...
260
-
"90": "ninety"
261
-
},
262
-
"units" : [
263
-
"hundred",
264
-
"thousand",
265
-
"million",
266
-
"billion",
267
-
"trillion",
268
-
...
269
-
"quindecillion"
270
-
],
271
-
"unitExceptions": []
272
-
}
273
-
```
274
-
275
-
### Spanish configuration example
276
-
```json
277
-
{
278
-
"useLongScale": true,
279
-
"baseSeparator": " y ",
280
-
"unitSeparator": "",
281
-
"base": {
282
-
"0": "cero",
283
-
"1": "uno",
284
-
"2": "dos",
285
-
"3": "tres",
286
-
...
287
-
"1000": "mil"
288
-
},
289
-
"unitExceptions": {
290
-
"1": "un"
291
-
},
292
-
"units" : [
293
-
{
294
-
"singular": "ciento",
295
-
"useBaseInstead": true,
296
-
"useBaseException": [1]
297
-
},
298
-
{
299
-
"singular": "mil",
300
-
"avoidPrefixException": [1]
301
-
},
302
-
{
303
-
"singular": "millón",
304
-
"plural": "millones"
305
-
},
306
-
...
307
-
]
308
-
}
309
-
```
310
-
311
206
## Contributing
312
-
Do your changes and submit a PR. If you've write access and want to bump the
313
-
version, run `mversion [major|minor|patch] -m`. That'll bump both `bower.json`
314
-
and `package.json`.
207
+
Do your changes and submit a PR. If you've write access and want to bump the version, run `mversion [major|minor|patch] -m`. That'll bump both `bower.json` and `package.json`.
315
208
316
209
## License
317
-
This code is licensed under the MIT license for Pedro Tacla Yamada. For more
318
-
information, please refer to the [LICENSE](/LICENSE) file.
210
+
This code is licensed under the MIT license for Pedro Tacla Yamada. For more information, please refer to the [LICENSE](/LICENSE) file.
0 commit comments