问题描述
是否可以在Angular6的组件的源代码内部转换字符串。
Is it possible to translate strings inside the source code of a component in Angular6.
F。 e。
window.confirm("HELP me");
除了HTML文件的常规翻译()。
I haven't found anything besides the normal translation for the HTML files (Angular Docs i18n).
请先谢谢您
推荐答案
您可以使用,直到Angular i18n获得对它的内置支持(大概在版本9左右)。作者正在研究Angular i18n,所以我认为它是可以放心,他对它的期望将接近Angular i18n的未来功能。
You can use https://github.com/ngx-translate/i18n-polyfill until Angular i18n get built-in support for it, probably around version 9. The author is working on Angular i18n, so I think it is safe to trust his expectation that it will be close to the future feature in Angular i18n.
在本期中,关于Angular i18n的未来有很多有趣的信息:
There is a lot of interesting information about the future of Angular i18n in this issue: https://github.com/angular/angular/issues/16477
这篇关于翻译Angular Typescript代码中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!