如何解决* ngFor中的角度翻译
我目前正在@angular-devkit/core 10.0.8
上从事角天气应用的翻译。
在表单组件中,我列出了一套城市定位方法,如果有一天我想实现一些其他功能,例如增加输入GPS工具定位的可能性
allMethods = [
{ id: 1,name: 'City',inputs: ['Name of city'] },{ id: 2,name: 'Geographic',inputs: ['latitude of city','longitude of the city'] },];
在inputComponent.ts中 这是我在模板html视图中所做的事情(我只放置了模板中有趣的部分):
<div class="col-sm-6">
<div class="form-check" *ngFor="let method of methods">
<input class="form-check-input" type="radio" name="City" id="{{method.name}}" [value]="method.name"
(click)="changeMethod($event)" [checked]="method.name == 'City'">
<label [for]="method.name">
{{method.name}}
</label>
</div>
</div>
交互式表格的结果:
form with name input selection image
form with latitude/longitude image
现在,我要翻译的是右侧标签中的“城市”和“地理”。我已经尝试过使用i18n select方法:没用,我尝试将{{method.name | translate}}这样的管道翻译与使用@ngx-translate/core
的翻译管道一起使用。确实可以,但是我对实现它的方式并不满意,因此我宁愿不使用ngx转换。没有它,还有可能吗?如何做?
谢谢你的帮助。
附言:我读了一些有关它的文章,但已经过时了
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。