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
@@ -64,141 +64,55 @@ Currently supported languages are:
64
64
| Indonesian |`id`|
65
65
66
66
67
-
## Configure your own language
68
-
Each language has it's own unique grammar exceptions. You can create your own
67
+
## Contributing
68
+
69
+
### Configure your own language
70
+
Each language has its own unique grammar exceptions. You can create your own
69
71
language.json file in the folder "i18n" and give writtenNumber support for it. I
70
72
don't think the current scheme and logic cover all the cases, but may be cover
71
73
some.
72
74
73
-
##### useLongScale:
74
-
'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.
75
-
76
-
##### baseSeparator:
77
-
'String' that separates the base cardinal numbers.
78
-
Example: 29 -> twenty`-`eight. Spanish uses the conector " y ".
79
-
80
-
##### unitSeparator:
81
-
'String' that separates the units from the last base cardinal numbers.
82
-
Example: 1234 -> one thousand two hundred **and** thirty-four
83
-
84
-
##### allSeparator:
85
-
'String' that separates all cardinals, not only the last one.
86
-
Example: 1125 -> ألف **و**مائة **و**خمسة **و**عشرون
87
-
88
-
##### base:
89
-
Base cardinals numbers. Numbers that have unique names and are used to build others.
90
-
91
-
##### alternativeBase:
92
-
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`.
93
-
94
-
```json
95
-
"alternativeBase": {
96
-
"feminine": {
97
-
"1": "одна",
98
-
"2": "дві"
99
-
}
100
-
}
101
-
```
102
-
103
-
##### units:
104
-
Number units.
105
-
It can be:
106
-
- String
107
-
- Object normal flow. Give support to singular, dual, and plural units. English does not need this, but spanish does.
108
-
```json
109
-
{
110
-
"singular": "millón",
111
-
"plural": "millones"
112
-
}
113
-
```
114
-
115
-
- Object with `few` word form.
75
+
The following parameters have been used for the currently available languages:
116
76
117
-
In some languages like Ukrainian, there are specific unit forms for values from 2 (including) to 4 (including). This forms can be specified with `few`.
118
77
119
-
```json
120
-
{
121
-
"singular": "мільйон",
122
-
"few": "мільйони",
123
-
"plural": "мільйонів",
124
-
}
125
-
```
126
-
127
-
- Object with `useAlternativeBase`.
128
-
129
-
Selects an `alternativeBase` name which this unit should prefer over the default `base` if possible.
|`useLongScale`| boolean | Indicates if it uses [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. |
83
+
|`baseSeparator`| string | Separates the base cardinal numbers. | 29 -> twenty`-`eight. Spanish uses the connector " y " |
84
+
|`unitSeparator`| string | Separates the units from the last base cardinal numbers. | 1234 -> one thousand two hundred **and** thirty-four |
85
+
|`allSeparator`| string | Separates all cardinals, not only the last one. | 1125 -> ألف **و**مائة **و**خمسة **و**عشرون |
86
+
|`base`| Object | Base cardinals numbers. Numbers that have unique names and are used to build others. ||
87
+
|`alternativeBase`| Object | Alternative versions of base cardinals numbers for usage with specific units. These bases will be treated as an extension for the default `base`. |``` "alternativeBase": { "feminine": {"1":"одна","2":"дві"} } ```|
88
+
|`units`| Array | A list of number units (string or Object). Gives support to singular, dual an plural units. Check the Object parameters below. ||
89
+
|`unitExceptions`| Object | Sometimes grammar exceptions affect the base cardinal joined to the unit. You can set specific exceptions to any base cardinal number. | Converting 1232000 in Spanish: Without Exception (Wrong): -> **uno** millón doscientos treinta y dos mil With Exception: -> **un** millón doscientos treinta y dos mil |
140
90
141
-
- Object with `useBaseInstead` exception.
91
+
### Units parameters
142
92
143
-
In some languages like spanish and arabic, specific units like "ciento", use the base cardinal number instead.
93
+
A `unit` can be:
94
+
- A simple string. e.g. `"hundred"`
95
+
- An Object with multiple parameters:
144
96
145
-
- Object with `useBaseException`: You can also specify with which unit (1 to 9) you don't
146
-
want use the base cardinal instead and use the regular behaviour:
97
+
| Unit parameter | Description | e.g. of languages |
|`useBaseInstead`| Use the base cardinal number instead. |`es`,`hu`,`pt`|
105
+
|`useBaseException`| Specify with which unit (1 to 9) you don't want to use the base, and instead use the regular behavior. |`es`,`hu`,`pt`|
106
+
|`avoidPrefixException`| Units not using the base cardinal number prefix for unit 1. |`id`,`tr`,`it`|
107
+
|`avoidInNumberPlural`| Units not using the plural form with trailing numbers other than 0. |`fr`|
108
+
|`restrictedPlural`| Plural only for 3 to 10. Singular if >= 11. |`ar`|
109
+
|`useSingularEnding`| Use singular form for numbers ending with 1. |`uk`|
110
+
|`useFewEnding`| Use _few_ form for numbers ending with 2, 3 or 4. |`uk`|
111
+
|`avoidEndingRules`| Plural form used instead of `useSingularEnding` and `useFewEnding`|`uk`|
147
112
148
-
```json
149
-
{
150
-
"singular": "ciento",
151
-
"useBaseInstead": true,
152
-
"useBaseException": [1]
153
-
}
154
-
```
155
-
- Object with `avoidPrefixException` exception:
156
-
In some languages like spanish, specific units like "mil" does not use the base
157
-
cardinal number prefix for unit 1.
158
-
```json
159
-
{
160
-
"singular": "mil",
161
-
"avoidPrefixException": [1]
162
-
}
163
-
```
164
-
- Object with `avoidInNumberPlural` exception.
165
-
In some languages like french, specific units like "cent" does not use the plural form inside of
166
-
numbers wioth trailing numbers other than 0, for example "deux cents" and "deux cent trois".
167
-
```json
168
-
{
169
-
"singular": "cent",
170
-
"plural": "cents",
171
-
"avoidInNumberPlural": true
172
-
}
173
-
```
174
-
- Object with `restrictedPlural` boolean:
175
-
If plural is used only for numbers from 3 to 10 , but the singular form is used if the number is older than 11.
176
-
177
-
- Object with `useSingularEnding` exception and `useFewEnding` exception.
178
-
179
-
In some languages like Ukrainian, singular form of the unit is also used for any values that end with 1 (21, 31, 14, ..., 101, ...) and "few" form of the unit is also used for any values that end with 2, 3 and 4 (22, 33, 44, ..., 104, ...). The `avoidEndingRules` exception provides values (1 to 999) where these rules must be ignored and the plural form must be used instead.
Sometimes grammar exceptions affect the base cardinal joined to the unit. You
194
-
can set specific exceptions to any base cardinal number.
195
-
Spanish example:
196
-
```
197
-
Without Exception (Wrong): 1232000 -> **uno** millón doscientos treinta y dos mil
198
-
With Exception: 1232000 -> **un** millón doscientos treinta y dos mil
199
-
```
200
114
201
-
##Contributing
115
+
### Versioning
202
116
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`.
0 commit comments