【发布时间】:2018-11-29 06:53:27
【问题描述】:
我尝试在 javascript 脚本中翻译一些文本。我有:
i18n: {
messages: {
en: {
i18n_profile_alert:'Please draw a geometry with the Geometry selection',
},
de: {
i18n_profile_alert:'Bitte zeichnen Sie mit der Geometry Auswahl eine Geometry',
},
},
},
在 HTML 中,我可以像这样得到我的翻译消息:
<span>{{$t('i18n_profile_alert')}}</span>
但在 javascript 中它不起作用:
entegetGeometry() {
const drawingUtil = vcs.vcm.util.Drawing.getInstance();
const drawingId = this.$refs.geometrySelection.getDrawingId();
if (!drawingId) {
this.notifyError({{$t('i18n_profile_alert')}});
return;
}
如何在 javascript 代码中引用我的消息?
【问题讨论】:
标签: javascript internationalization translate