JHipster新模块:无法添加翻译

JHipster新模块:无法添加翻译,jhipster,Jhipster,我在JHipster中添加了一个新模块,其中包含几个组件。我想用JHipsterTraslationService在html部分添加翻译,并尝试过这样做,但我不知道。我想我必须使用新的服务,但我不知道如何使用。Jhipster在html中使用jhiTranslate,例如:我的默认欢迎文本, 这是指translation.json文件中字段的值,它将在该文件中查找该字段,并将其替换为具有的值。否则,它将显示值,即我的默认欢迎文本 使用angular cli使用jhipster创建组件时,将在应用

我在JHipster中添加了一个新模块,其中包含几个组件。我想用JHipsterTraslationService在html部分添加翻译,并尝试过这样做,但我不知道。我想我必须使用新的服务,但我不知道如何使用。

Jhipster在html中使用jhiTranslate,例如:我的默认欢迎文本, 这是指translation.json文件中字段的值,它将在该文件中查找该字段,并将其替换为具有的值。否则,它将显示值,即我的默认欢迎文本

使用angular cli使用jhipster创建组件时,将在应用程序的每个语言文件夹中创建翻译文件。例如:myApplicationName\src\main\webapp\i18n\en

这是他们在文档中创建组件的示例:

ng generate component my-new-component
ng g component my-new-component # using the alias

# Components support relative path generation
# Go to src/app/feature/ and run
ng g component new-cmp
# your component will be generated in src/app/feature/new-cmp
# but if you were to run
ng g component ../newer-cmp
# your component will be generated in src/app/newer-cmp
我相信使用这种创建方法很容易,而且更好,因为它将创建所有必要的文件,无论是组件、服务、指令、路由等

此外,如果已经创建了组件,则必须根据应用程序的语言在相应的文件夹中手动创建每个.json文件。您还可以向应用程序中添加其他语言

另一方面。。。。你可以尝试用生成器添加其他语言。并检查是否添加了文件以及更改了哪些内容,这样您就可以知道哪些文件或订阅可以更改

我希望这有帮助