angular - Angular i18n:将翻译字符串转发到自己的组件
问题描述
我有一个自己的组件,看起来像这样简化:
<mat-form-field class="example-full-width">
<mat-label>{{myLabel}}</mat-label>
<input matInput placeholder="Ex. Pizza" value="Sushi">
</mat-form-field>
在ts
代码中类似于
@Input() myLabel:string;
当我现在想将它包含在我用于 HTML 部分的组件中时:
<my-component [label]="'Favorite food'"></my-component>
我的问题:如何以label
翻译的方式指定内容?它适用于i18n-label
??? 或者我需要在组件中添加一些额外的东西吗?
解决方案
推荐阅读
- sql - 计算期初余额和期末余额 SQL Server
- c++ - 我可以使用什么现成的组件来存储整数部分中具有任意精度的数字而小数部分中的精度有限?
- airflow - 气流连接字符串格式?
- ssis - 来自excel源数据的SSIS增量负载
- java - 在 java 中使用自定义序列化时,我们是否必须调用父类的 readObject() 方法?
- asp.net - 选择列表时的引导模式弹出问题已关闭?
- java - Glide 4.7.1 监听器不适用于 onResourceReady 方法和异常监听器
- python - 使用 python 和 lxml 访问重复的特定 xml 元素
- node.js - 尝试在发布路线上发表评论时出错
- apache-spark - Hive 外部表无法查看分区 Parquet 文件