我见过一些使用 XLIFF 标签来包装变量的 Google 应用程序和代码示例。我看到这样做有一些很大的优势,特别是对于替换非描述性格式参数,例如%1$s
.
不幸的是,XLIFF 似乎并没有很好地集成到 ADT 中。以以下字符串资源为例:
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"
xmlns:tools="http://schemas.android.com/tools">
<string name="share_with_application">
Share your score of <xliff:g id="score" example="1337">%1$s</xliff:g>
with <xliff:g id="application_name" example="Bluetooth">%2$s</xliff:g>!
</string>
</resources>
在上面的示例中,字符串在第一个之后被截断<xliff>
标签。人们还期望example
要使用的属性,导致图形预览显示:
分享您的蓝牙 1337 分!
目前在我的字符串资源中使用 XLIFF 标签有什么优点吗?
我们刚刚在 Android Studio 0.3 版本中添加了对此的支持:https://android-review.googlesource.com/#/c/67724/ https://android-review.googlesource.com/#/c/67724/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)