I can confirm what @JB Nizet is referring to in his answer is now working in Angular 9, so this works: foo() { const appTitle = $localize`:@@siteTitle:Example Title`; // appTitle is now translated based on locale titleService.setTitle(appTitle); }您可以在此处 https://github.com/angular/angular/blob/master/packages/localize/init/index.ts 这篇关于我可以使用Angular i18n转换打字稿代码中的字符串文字吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-21 00:31