Centralization of locale data collection for AWS Amplify.
AWS Amplify I18n is available as amplify-i18n
package on npm.
$ npm install amplify-i18n --save
Somewhere in your app, preferably at the root level, configure Amplify I18n.
If you don't specify any locales to the configure
method, all the available locales will be loaded.
import { I18n } from "aws-amplify"
import AmplifyI18n from "amplify-i18n"
AmplifyI18n.configure()
I18n.setLanguage("fr")
If you want to load only a subset of the available locales, pass an array to the configure
method.
import { I18n } from "aws-amplify"
import AmplifyI18n from "amplify-i18n"
const locales = ["en", "fr", "de"]
AmplifyI18n.configure(locales)
I18n.setLanguage("fr")
Amplify I18n follows the Best Current Practice 47 (BCP47) Tags for Identifying Languages.
Currently the following locales are available:
Tag | Language |
---|---|
ar | Arabic |
de | German |
en | English |
es | Spanish |
fr | French |
he | Hebrew |
it | Italian |
ja | Japanese |
ko | Korean |
nl | Dutch |
pt-BR | Portuguese (Brazil) |
ru | Russian |
zh-Hans | Simplified Chinese |
zh-Hant | Traditional Chinese |
Translations are provided by Locale for the community