Look at the source code today found in the resource file/res/values/strings.xml some <string> tags include <xliff:g> tags, such as:
<name= "Running_process_item_user_label">< ID = "user_name" >%1 $ s</xliff:g></string>
This label has not been used before, and I looked it up on the Internet. The Xliff foreign name is the XML Localization interchange File format, and the Chinese name is the XML localized data Interchange format.
<xliff:g> Label Description:
Property ID can be arbitrarily named
The attribute example represents an example, omitting
%n$ms: The output is a string, n is the number of parameters, setting the value of M can place a space before the output
%N$MD: The output is an integer, n is the number of parameters, setting the value of M can be placed before the output space, or can be set to 0m, before the output of M 0
%N$MF: 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
To illustrate:
<ResourcesXmlns:xliff= "urn:oasis:names:tc:xliff:document:1.2"> <stringname= "Welcome">Welcome<xliff:gID= "Name">%1 $ s</xliff:g>Ranking<xliff:gID= "num">%2$d</xliff:g> </string></Resources>
Use the <xliff:g> tag to add a namespace to the resources and then use it in the Android program
Public final String getString (int resId, Object ... formatargs)
String s = getString (R.string.welcome, "abc", 123);
Output: Welcome to ABC, ranking 123
Use of <xliff:g> tags in android