【发布时间】:2021-07-22 13:21:24
【问题描述】:
使用时如何设置作用域:this.translocoService.translate('object.test');?
我的翻译文件位于“MyFolder”之类的文件夹中,因此范围为 MyFolder。
这是我的 *.json 文件的结构:
{
"demo": "test123",
"object" : {
"test" : "My.Test"
}
}
这是我喜欢做的事情:
export class AppComponent {
constructor(private translocoService: TranslocoService,@Inject(TRANSLOCO_SCOPE) private scope) {}
ngOnInit() {
this.translocoService.translate('object.test'); //How to set the scope here?
}
}
【问题讨论】:
标签: angular internationalization transloco