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>我正在尝试翻译不同语言的网站文本使用亚马逊网络服务放大i18n功能。我正在关注AWS-amplify参考https://docs.amplify.aws/lib/utilities/i18n/q/platform/js#setlanguage
但是我很难从HTML调用函数来用中文显示。
发布于 2020-06-04 15:46:18
你的"get“没有被赋值给一个变量。尝试将get赋值给变量并将其绑定到UI。
this.text = I18n.get('Hello There');然后在你的HTML中
<p>{{text}}</p>https://stackoverflow.com/questions/62169367
复制相似问题