Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Apr 29, 2024

Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New project should use Amplify Gen 2. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade. Switch to the latest Gen 2 docs →

Internationalization

The AWS Amplify I18n module is a lightweight internationalization solution.

Installation

import { I18n } from 'aws-amplify';

Working with the API

setLanguage()

Sets the active language.

I18n.setLanguage('fr');

In the browser, Amplify detects browser language automatically. For mobile you may want to use other libraries to detect the language, and then set it using Amplify in your code.

putVocabularies()

You can create your custom dictionary and set it as your vocabularies in your app. Dictionary is a JavaScript object that you can implement with different terms and languages.

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

get()

Retrieves a phrase from the dictionary for the active language. If the phrase does not have an entry in the dictionary, the original parameter value will be returned.

I18n.get('Sign In');