"Turn" http://blog.csdn.net/xipiaoyouzi/article/details/7891153
Today I saw a Google demo, found that some of the resource string in/res/values/string.xml contains a similar xliff node, just checked, Xliff is XML Localization interchange File The abbreviation for format, the Chinese name is XML localized data Interchange format.
For the resource string in Android, there may be similar to the following <xliff:g id= "file_name" >%1$s</xliff:g> notation, here, id we can arbitrarily define, behind the%1 $ s 1% Indicates that this is the first replaceable amount, s represents a string
Detailed introduction is as follows:
Property ID can be named casually
The attribute example represents an example, which can be omitted
%n$ms: Represents the output of a string, n is the number of parameters, set the value of M can be placed before the output space
%N$MD: Represents the output is an integer, n is the number of parameters, set the value of M can be placed before the output space, can also be set to 0m, before the output of M 0
%N$MF: Represents the output is a floating-point number, n is the number of parameters, setting the value of M can control the scale, such as m=2.2, the output format is 00.00
For example, there are multiple variables in a string that need to be replaced, and you can define the following variables in the XML:
<string name= "Info" >
Your name is <xliff:g id= "name" >%1$S</XLIFF:G>, and your
<xliff:g id= "Age" >%2$s</xliff:g>
</string>
Dynamic loading in the program:
TextView TV = (TextView) Findviewbyid (R.id.textview);
String info = getresources (). getString (R.string.info, "Jnhoodlum", "22");
Tv.settext (info);
One last thing to note: In the string, you increase the xmlns of xliff:
<resources xmlns:android= "Http://schemas.android.com/apk/res/android"
xmlns:xliff= "urn:oasis:names:tc:xliff:document:1.2" >
Application of Xliff in Android