我试图使用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)