翻译Angular Typescript代码中的字符串 [英] Translate strings inside Angular Typescript code

查看:113
本文介绍了翻译Angular Typescript代码中的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Angular6的组件的源代码内部转换字符串。

Is it possible to translate strings inside the source code of a component in Angular6.

F。 e。

window.confirm("HELP me");

除了HTML文件的常规翻译( Angular Docs i18n )。

I haven't found anything besides the normal translation for the HTML files (Angular Docs i18n).

请先谢谢您

推荐答案

您可以使用 https://github.com/ngx-translate/i18n-polyfill ,直到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的未来有很多有趣的信息: https://github.com/angular/angular/issues/16477

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代码中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆