XLIFF

XLIFF (XML Localisation Interchange File Format) is an XML-based format created to standardizelocalization.

XLIFF(xml  本地化交换文件格式)是基于XML用于本地语音标准化。

 

http://en.wikipedia.org/wiki/XLIFF 写道
Description

An XLIFF document is composed of one or more <file> elements. Each <file> element corresponds to an original file or source (i.e. database table). A <file> contains the source of the localizable data and, once translated, the corresponding localized data for one, and only one, locale.
Localizable data are stored in <trans-unit> elements. The <trans-unit> element holds a <source> element to store the source text, and a <target> element to store the latest translated text. The <target> elements are not mandatory.
<trans-unit id="1">
<source xml:lang="en">Cannot find the file.</source>
<target xml:lang="fr">Fichier non trouvé.</target>
</trans-unit>

 android中的strings.xml,需要resources中加入命名空间

 

 

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

 

    <string name="string_search">character \'<xliff:g id="string">%s</xliff:g>\': </string>

</resources>

注意到绿色,是xliff标签

在android程序中就可以如下使用

getString(R.string.string_search, "参数")

 

具体getString用法参见如下android文档

public final String getString (int resId, Object... formatArgs)
Since: API Level 1

Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in Formatter and format(String, Object...).

Parameters
resId Resource id for the format string
formatArgs The format arguments that will be used for substitution.  

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值