我试图使用 i18n SELECT 语法来翻译输入字段的占位符:
<input placeholder="{userRole, admin{you are an admin} other {you are a user}}" i18n-placeholder="MYAPP.PLACEHOLDER|my placeholder">
这将导致以下 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>
因此,似乎无法识别 SELECT 语法。当我使用语法不翻译属性而是元素的内容时,.xlf 标记如下所示:
<source>{VAR_SELECT, admin{you are an admin} other {you are a user}}</source>