[英]ngx-translate if a key is missing in one of the json file replace with other json file same key
I have a scenario, I have two languages files en.json & es.json
I have a key in en.json
file which is missed in es.json
file, however, I want to replace this missing key with the en.json
key how would I achieve this. I have a scenario, I have two languages files
en.json & es.json
I have a key in en.json
file which is missed in es.json
file, however, I want to replace this missing key with the en.json
key我将如何实现这一目标。
I know the way we use MissingTranslationHandler for missing keys, but I do not want to show a default text for missing keys, Although I'm doing this for a missed key from both files, in my scenario its different.我知道我们使用 MissingTranslationHandler 处理丢失键的方式,但我不想显示丢失键的默认文本,尽管我正在为两个文件中的丢失键执行此操作,但在我的场景中它是不同的。
Any help would be greatly appreciated, thanks in advance!任何帮助将不胜感激,在此先感谢!
Inside your app module constructor, you can tell what is the default language which you're interested in在您的应用程序模块构造函数中,您可以知道您感兴趣的默认语言是什么
export class AppModule {
constructor(translate: TranslateService) {
translate.setDefaultLang('en');
translate.use('en');
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.