|
|
|
@ -29,19 +29,13 @@ const i18n = editor.I18n; |
|
|
|
* `i18n:update` - The set of messages is updated |
|
|
|
* `i18n:locale` - Locale changed |
|
|
|
|
|
|
|
## getConfig |
|
|
|
|
|
|
|
Get module configurations |
|
|
|
|
|
|
|
Returns **[Object][2]** Configuration object |
|
|
|
|
|
|
|
## setLocale |
|
|
|
|
|
|
|
Update current locale |
|
|
|
|
|
|
|
### Parameters |
|
|
|
|
|
|
|
* `locale` **[String][3]** Locale value |
|
|
|
* `locale` **[String][2]** Locale value |
|
|
|
|
|
|
|
### Examples |
|
|
|
|
|
|
|
@ -55,7 +49,7 @@ Returns **this** |
|
|
|
|
|
|
|
Get current locale |
|
|
|
|
|
|
|
Returns **[String][3]** Current locale value |
|
|
|
Returns **[String][2]** Current locale value |
|
|
|
|
|
|
|
## getMessages |
|
|
|
|
|
|
|
@ -63,8 +57,8 @@ Get all messages |
|
|
|
|
|
|
|
### Parameters |
|
|
|
|
|
|
|
* `lang` **[String][3]?** Specify the language of messages to return |
|
|
|
* `opts` **[Object][2]?** Options (optional, default `{}`) |
|
|
|
* `lang` **[String][2]?** Specify the language of messages to return |
|
|
|
* `opts` **[Object][3]?** Options (optional, default `{}`) |
|
|
|
|
|
|
|
* `opts.debug` **[Boolean][4]?** Show warnings in case of missing language |
|
|
|
|
|
|
|
@ -77,7 +71,7 @@ i18n.getMessages('en'); |
|
|
|
// -> { hello: '...' } |
|
|
|
``` |
|
|
|
|
|
|
|
Returns **[Object][2]** |
|
|
|
Returns **[Object][3]** |
|
|
|
|
|
|
|
## setMessages |
|
|
|
|
|
|
|
@ -85,7 +79,7 @@ Set new set of messages |
|
|
|
|
|
|
|
### Parameters |
|
|
|
|
|
|
|
* `msg` **[Object][2]** Set of messages |
|
|
|
* `msg` **[Object][3]** Set of messages |
|
|
|
|
|
|
|
### Examples |
|
|
|
|
|
|
|
@ -106,7 +100,7 @@ Update messages |
|
|
|
|
|
|
|
### Parameters |
|
|
|
|
|
|
|
* `msg` **[Object][2]** Set of messages to add |
|
|
|
* `msg` **[Object][3]** Set of messages to add |
|
|
|
|
|
|
|
### Examples |
|
|
|
|
|
|
|
@ -127,10 +121,10 @@ Translate the locale message |
|
|
|
|
|
|
|
### Parameters |
|
|
|
|
|
|
|
* `key` **[String][3]** Label to translate |
|
|
|
* `opts` **[Object][2]?** Options for the translation (optional, default `{}`) |
|
|
|
* `key` **[String][2]** Label to translate |
|
|
|
* `opts` **[Object][3]?** Options for the translation (optional, default `{}`) |
|
|
|
|
|
|
|
* `opts.params` **[Object][2]?** Params for the translation |
|
|
|
* `opts.params` **[Object][3]?** Params for the translation |
|
|
|
* `opts.debug` **[Boolean][4]?** Show warnings in case of missing resources |
|
|
|
|
|
|
|
### Examples |
|
|
|
@ -148,12 +142,18 @@ obj.t('msg2', { l: 'it', params: { test: 'hello' } }); // custom local |
|
|
|
// -> outputs `Msg hello it` |
|
|
|
``` |
|
|
|
|
|
|
|
Returns **[String][3]** |
|
|
|
Returns **[String][2]** |
|
|
|
|
|
|
|
## getConfig |
|
|
|
|
|
|
|
Get configuration object |
|
|
|
|
|
|
|
Returns **[Object][3]** |
|
|
|
|
|
|
|
[1]: https://github.com/artf/grapesjs/blob/master/src/i18n/config.ts |
|
|
|
|
|
|
|
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object |
|
|
|
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String |
|
|
|
|
|
|
|
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String |
|
|
|
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object |
|
|
|
|
|
|
|
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean |
|
|
|
|