Pau*_*sma 15 android adt xliff
我已经看到一些使用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>
Run Code Online (Sandbox Code Playgroud)

在上面的示例中,字符串在第一个<xliff>标记之后被截断.人们还希望使用该example属性,从而产生图形预览:
与蓝牙分享你的1337分!
目前在我的字符串资源中使用XLIFF标签是否有任何优点?
Tor*_*bye 14
我们刚刚在Android Studio中添加了对此版本0.3的支持:https: //android-review.googlesource.com/#/c/67724/
为了清楚起见,在Android字符串资源中使用XLIFF标记已完整记录在
https://developer.android.com/distribute/tools/localization-checklist.html#manage-strings
即使在Eclipse构建中,这样的字符串也能正常工作(支持在构建应用程序的aapt工具中).
但是,如问题所示,ADT中包含的图形布局工具不会对xliff标记进行任何限制,只是在第一个这样标记的子字符串之后截断字符串.
Android Studio中的图形工具可以很好地处理这些字符串,了解并利用xliff标记.
我实际上发现<xliff:g>我的源代码中的full 是相当冗长的,所以我调整了namepsace声明以允许我这样使用<x:g>:
<resources xmlns:x="urn:oasis:names:tc:xliff:document:1.2">
<string name="greeting">Hello <x:g id="name">%1$s</x:g>!</string>
</resources>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10947 次 |
| 最近记录: |