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
- Improved the description of arguments to the add(items, locale, prefix) function;
- Added a table describing allowed arguments to the setPluralizationRule(locale, rule, options) function.
Copy file name to clipboardExpand all lines: src/i18n/create-i18n.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,9 +40,9 @@ The following arguments can be passed to the `add()` method.
40
40
41
41
| Argument | Type | Required | Description |
42
42
| --- | --- | --- | --- |
43
-
|`items`|`object`| Yes | The object containing messages |
43
+
|`items`|`object`| Yes | The object containing messages. The value of each message can be a simple string or, in the case of pluralized messages, an array of strings.|
44
44
|`locale`|`string`|| An optional locale for the messages. For example `es`. The default is `en`|
45
-
|`prefix`|`string`|| An optional prefix for the messages |
45
+
|`prefix`|`string`|| An optional prefix for the messages. It will be automatically prepended to each item's key.|
46
46
47
47
Pluralization is set by adding an array of messages to the `items` object.
The `setPluralizationRule()` method sets a locale-specific pluralization rule function to determine plural form variation index.
157
157
158
+
| Argument | Type | Required | Description |
159
+
| --- | --- | --- | --- |
160
+
|`locale`|`string`| Yes | The locale that the `rule` function is defined for |
161
+
|`rule`|`function`| Yes | A locale-specific function that receive a count as parameter and returns an index into the array of pluralized translated messages |
162
+
|`options`|`object`|| An optional set of locale-specific options for the pluralization rule |
163
+
158
164
```js
159
165
i18n.setPluralizationRule('en', function (count) {
0 commit comments