Android string resource string to insert certain characters

Source: Internet
Author: User

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

Many Android Developers may find some resource strings in/RES/values/string. XML contains nodes similar to xliff. xliff is the abbreviation of XML localization interchange file format. The Chinese name is the XML localized data exchange format. for Android resource strings, there may be <xliff: G id = "file_name"> % 1 $ S </xliff: G> below. Here, we can define the ID as needed, % 1 $ S is a bit like the string formatting mark in C #. $ D represents an integer. Here 1% represents the first replaceable amount, if a string contains multiple variables to be replaced

<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 );

 

This sentence is very important ~

Adding the xmlns of xliff to the string will be OK.

<Resources xmlns: xliff = "urn: Oasis: names: TC: xliff: Document: 1.2">

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.