XLIFF is an XML-based format that enables translators to concentrate on the text to be translated. Likewise, since it's a standard, manipulating XLIFF files makes localization engineering easier: once you have converters written for your source file formats, you can simply write new tools to deal with XLIFF and not worry about the original file format. It also supports a full localization process by providing tags and attributes for review comments, the translation status of individual strings, and metrics such as word counts of the source sentences

很多Android开发者可能会发现部分资源字符串在/res/values/string.xml中包含有类似xliff的节点,Xliff是XML Localization Interchange File Format 的缩写,中文名为XML本地化数据交换格式,对于在Android的资源字符串中,可能会有类似下面的 <xliff:g id="FILE_NAME">%1$s</xliff:g> 这里,id我们可以随便定义,后面的%1$s有点像C#中的字符串格式化标志,这里1%表示这是第一个可替换量,如果一个String中有多个需要替换的变量,可以为

<string name="wangjieming">
hello<xliff:g id="FILE_NAME">%1$s</xliff:g>aaaaaaaaaaaaa
<xliff:g id="EXACT_REASON">%2$s</xliff:g>
"</string>


TextView tv = (TextView) findViewById(R.id.textView1);

String info = getResources().getString(R.string.wangjieming,"wangjieming","13312344321");

tv.setText(info);

这句话很重要哦~

在String里增加XLIFF的 xmlns 就OK了

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">


更多相关文章

  1. Android URL访问网络资源,通过URL加载网络图片
  2. Android 菜单资源
  3. 【Android Studio】Resource Merging资源合并规则
  4. Android Root SuperUser su相关资源
  5. 获取Android自带资源的方式
  6. android studio运行应用报找不到资源问题

随机推荐

  1. Android 屏幕真实分辨率获取
  2. Android 对程序异常崩溃的捕捉
  3. 【Android】定位与解决anr错误记录
  4. Android:验证EditText输入框输入的手机号
  5. android activity之间传递bean类型数据
  6. Android APP开发集成工具
  7. Android View之组合控件实例(二)
  8. 蓝牙原理Android代码实现
  9. NDK is missing a "platforms" directory
  10. 苹果MAC操作系统上搭建Android开发平台环