简体   繁体   English

如何使用 ngx translate to angular 将数据转换为 ts

[英]How to translate data to ts using ngx translate to angular

component.ts组件.ts

I have this code in app.component.ts and it needs to be translated to select option我在 app.component.ts 中有这段代码,需要将其转换为 select 选项

label = ['', 'label1', 'label2']

component.html组件.html

html uses ng For html 使用 ng For

<select>
   <option *ngFor="let value of label">{{value}}</option>
</select>

Use the pipe to translate it in the template.使用pipe在模板中翻译它。

<select>
   <option *ngFor="let value of label">{{value | translate}}</option>
</select>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用参数动态翻译文本文件到 angular 中的 ngx-translate? - How to dynamic translate text file using parameter to the ngx-translate in angular? 从本地存储中获取数据并使用 ngx-translate 将其显示在视图中 | Angular - Get data from localstorage and display it in view using ngx-translate | Angular 在 Angular 4+ 中使用 ngx-translate 进行本地化(国际化)? - Localization (internationalization) in Angular 4+ using ngx-translate? 如何从 Angular 6 中的组件中提取文本进行翻译 (ngx-translate) - How to extract text from components in Angular 6 for translation (ngx-translate) ngx-translate 在 angular 8 中的 terinory 条件下 - ngx-translate in terinory condtion in angular 8 Angular 4 Ngx-translate管不起作用 - Angular 4 Ngx-translate pipe not working 使用组件作为 ngx-translate 键的参数 - Using a component as a parameter for a ngx-translate key Angular ngx-translate - 如何为翻译值中缺少的参数设置默认值 - Angular ngx-translate - How to set a default value for missing param in translation value 如何使用角度$ translate获取特定语言的键的翻译 - How to get the translations of a key in a particular language using angular $translate 角度翻译:在HTML插值字符串中使用.replace - Angular Translate: Using .replace in an interpolation string in HTML
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM