dob*_*ker 3 javascript internationalization angular-i18n angular
我试图使用i18n SELECT语法转换输入字段的占位符:
<input placeholder="{userRole, admin{you are an admin} other {you are a user}}" i18n-placeholder="MYAPP.PLACEHOLDER|my placeholder">
Run Code Online (Sandbox Code Playgroud)
这将导致以下xlf文件条目:
<trans-unit id="85f60a0a03b3b4e189252fc0157dd403e806bbcc" datatype="html">
<source>{userRole, admin{you are an admin} other {you are a user}}</source>
<context-group purpose="location">
<context context-type="sourcefile">path/to/my/file.component.ts</context>
<context context-type="linenumber">4</context>
</context-group>
<note priority="1" from="description">my placeholder</note>
<note priority="1" from="meaning">MYAPP.PLACEHOLDER</note>
</trans-unit>
Run Code Online (Sandbox Code Playgroud)
因此,似乎无法识别SELECT语法。当我使用语法而不是翻译属性而是元素的内容时,.xlf标签如下所示:
<source>{VAR_SELECT, admin{you are an admin} other {you are a user}}</source>
Run Code Online (Sandbox Code Playgroud)
dob*_*ker 10
似乎这是Angular的一个众所周知的问题
允许属性中的ICU消息[已阻止,需要更新参数
https://github.com/angular/angular/issues/16477
一种解决方法是使用其他标记来实现翻译:
<span i18n='SOME_TITLE|Description Text' #translatedPlaceholder>{VAR_SELECT, admin{you are an admin} other {you are a user}}</span>
<input [placeholder]="translatedPlaceholder.textContent" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
850 次 |
| 最近记录: |