【发布时间】:2020-05-03 10:42:48
【问题描述】:
为了在用户单击按钮时添加新警报,我按照关于通知系统部分的jhipster official website 中的说明进行操作。
当用户点击按钮时执行的函数现在看起来像这样:
randomMethod():void {
this.alertService.get().push(
this.alertService.addAlert(
{
type: 'danger',
msg: 'you should not have pressed this button!',
timeout: 3000,
toast: false,
scoped: true
},
this.alertService.get()
)
);
确实会显示新警报,但是因为我启用了国际化,所以我的警报消息显示如下:
translation-not-found[you should not have pressed this button!]
我需要做什么来为我的警报配置翻译?
编辑:它认为我需要修改我的 src\main\webapp\i18n 文件夹中的一个或多个文件
【问题讨论】:
-
是的,您必须输入密钥而不是消息,然后您必须在 src\main\webapp\i18n 中编辑与您的语言和页面以及密钥匹配的文件。
-
@GaëlMarziou 它们的键是否应该类似于传递给
jhiTranslate属性的键?我明白这是怎么回事。 -
是的,这是同一个键,它可以是使用点符号的路径。
-
@GaëlMarziou 效果很好。谢谢你的帮助!
标签: angular internationalization jhipster alert