Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 902 Bytes

i18n_guide.md

File metadata and controls

42 lines (31 loc) · 902 Bytes

I18n

AWS Amplify I18n module is a lightweight internationalization solution.

Language Detection

In browser, Amplify detects browser language. On mobile, there is no common way from vendor. You may want to use other libraries to get the language and set to Amplify.

import { I18n } from 'aws-amplify';

I18n.setLanguage('fr');

Dictionary

Dictionary is fed by your vocabularies, which in essence, is a Javascript object

const dict = {
    'fr': {
        'Sign In': "Se connecter",
        'Sign Up': "S'inscrire"
    },
    'es': {
        'Sign In': "Registrarse",
        'Sign Up': "Regístrate"
    }
};

I18n.putVocabularies(dict);

Translate

If the phrase does not have an entry in dictionary, the original will be returned.

    I18n.get('Sign In');