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

Page updated Apr 30, 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 →

国際化

AWS Amplify I18n モジュールは、軽量な国際化ソリューションです。

インストール

import { I18n } from 'aws-amplify/utils';

API の使用

setLanguage()

アクティブな言語を設定します。

I18n.setLanguage('fr');

ブラウザでは、Amplify は自動的にブラウザの言語を検出します。モバイルでは、別のライブラリを使用して言語を検出し、コード内で Amplify を使用して設定することをお勧めします。

putVocabularies()

カスタム辞書を作成し、アプリの vocabularies として設定できます。辞書は、異なる用語と言語で実装できる JavaScript オブジェクトです。

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

get()

アクティブな言語の辞書からフレーズを取得します。フレーズが辞書にエントリを持たない場合、元のパラメータ値が返されます。

I18n.get('Sign In');

API リファレンス

i18n モジュールの完全な API ドキュメントについては、API リファレンス をご覧ください。