angular 8 中的 AWS Amplify i18n 国际化
AWS Amplify i18n internationalization in angular 8
translate.ts
const dict = {
'bh': {
'Hello there!': "Apa khabar di sana!"
},
'ch': {
'Hello there!': "你好!"
}
};
I18n.putVocabularies(dict);
I18n.setLanguage('ch');
I18n.get('Hello there!');
translate.html
<h3>(how to call function to get translation)</h3>
我正在尝试使用 AWS amplify i18n 功能翻译不同语言的网站文本。我正在关注 AWS-amplify 参考 https://docs.amplify.aws/lib/utilities/i18n/q/platform/js#setlanguage
但我正在努力从 HTML 调用函数以显示中文。
您的 "get" 未分配给变量。
尝试将 get 分配给变量并将其绑定到 UI.
this.text = I18n.get('Hello There');
然后在你的HTML
<p>{{text}}</p>
translate.ts
const dict = {
'bh': {
'Hello there!': "Apa khabar di sana!"
},
'ch': {
'Hello there!': "你好!"
}
};
I18n.putVocabularies(dict);
I18n.setLanguage('ch');
I18n.get('Hello there!');
translate.html
<h3>(how to call function to get translation)</h3>
我正在尝试使用 AWS amplify i18n 功能翻译不同语言的网站文本。我正在关注 AWS-amplify 参考 https://docs.amplify.aws/lib/utilities/i18n/q/platform/js#setlanguage
但我正在努力从 HTML 调用函数以显示中文。
您的 "get" 未分配给变量。 尝试将 get 分配给变量并将其绑定到 UI.
this.text = I18n.get('Hello There');
然后在你的HTML
<p>{{text}}</p>