找不到JHipster翻译

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

我创建了一个全新的jhipster项目。在其中我还创建了一些实体组件,我想将其重用为嵌套组件。当我创建一个新模块并在一个新组件内并尝试将该实体用作嵌套组件时,该翻译不起作用:

我在新模块/组件中使用实体组件如下(jhi-pet是实体组件的选择器):

<mat-card>
<h1>Main Content....</h1>

<jhi-pet></jhi-pet>

如图所示,实体列表显示在新组件中,但转换不起作用。

另一种选择是将实体链接为路线(如下)

{
  path: 'pet', component: PetComponent
}

同样的问题在这里实体列表显示但没有翻译。

如果我直接进入像/ pets这样的实体页面,那么翻译工作......

这是我的jhipster配置:

    "generator-jhipster": {
"promptValues": {
  "packageName": "com.rem.app",
  "nativeLanguage": "tr"
},
"jhipsterVersion": "5.2.1",
"applicationType": "monolith",
"baseName": "REM",
"packageName": "com.rem.app",
"packageFolder": "com/rem/app",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"searchEngine": "elasticsearch",
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"jwtSecretKey": "replaced-by-jhipster-info",
"clientFramework": "angularX",
"useSass": true,
"clientPackageManager": "yarn",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "tr",
"languages": [
  "tr",
  "en",
  "de"

知道如何使用正确的翻译吗?

谢谢您的帮助。

jhipster
1个回答
2
投票

找到答案了!

在使用实体作为嵌套组件的新模块中,将其添加到构造函数中

constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) {
 this.languageHelper.language.subscribe((languageKey: string) => {
  if (languageKey !== undefined) {
    this.languageService.changeLanguage(languageKey);
  }
 });
}
© www.soinside.com 2019 - 2024. All rights reserved.