Update README.md with changes in I18n engine APIs (#47290) (#47984)

This commit is contained in:
Tiago Costa 2019-10-11 18:12:50 +01:00 committed by GitHub
parent 1a20d8c0e5
commit 6f7814b1c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,9 +61,9 @@ data to UI frameworks and provides methods for the direct translation.
Here is the public API exposed by this engine:
- `addMessages(messages: Map<string, string>, [locale: string])` - provides a way to register
- `addTranslation(newTranslation: Translation, [locale: string])` - provides a way to register
translations with the engine
- `getMessages()` - returns messages for the current language
- `getTranslation()` - returns messages for the current language
- `setLocale(locale: string)` - tells the engine which language to use by given
language key
- `getLocale()` - returns the current locale
@ -78,6 +78,7 @@ For the detailed explanation, see the section below
translate message by id. `description` is optional context comment that will be extracted
by i18n tools and added as a comment next to translation message at `defaultMessages.json`.
- `init(messages: Map<string, string>)` - initializes the engine
- `load(translationsUrl: string)` - loads JSON with translations from the specified URL and initializes i18n engine with them.
#### I18n engine internals