Jhipster-为新警报添加翻译

问题描述 投票:0回答:1

为了在用户单击按钮时添加新的警报,我遵循了关于[[通知系统的部分的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

文件夹中的一个或多个文件
angular internationalization jhipster alert
1个回答
0
投票
主页中发出警报,并且已选择

英语作为语言,则必须执行以下操作:

randomMethod():void { this.alertService.get().push( this.alertService.addAlert( { type: 'danger', msg: 'yourAppName.home.buttonAllertMessage', timeout: 3000, toast: false, scoped: true }, this.alertService.get() ) );

并且您将必须在buttonAllertMessage文件中添加新属性(src\main\webapp\i18n\en\home.json),如下所示:

{ "home": { "title": "Welcome", "subtitle": "This is your homepage", "logged": { "message": "You are logged in as user \"{{username}}\"." }, "question": "If you have any question on JHipster:", "link": { "homepage": "JHipster homepage", "stackoverflow": "JHipster on Stack Overflow", "bugtracker": "JHipster bug tracker", "chat": "JHipster public chat room", "follow": "follow @jhipster on Twitter" }, "like": "If you like JHipster, don't forget to give us a star on", "github": "GitHub", "buttonAllertMessage" : "you should not have pressed this button!" } } 然后您应该对配置的其他语言执行相同的操作。
© www.soinside.com 2019 - 2024. All rights reserved.