Skip to content Skip to sidebar Skip to footer

What's "msgid" And "xliff" In Strings.xml File?

Background Sometimes I see some weird attributes on the 'strings.xml' file made by Google's samples, for example, on the chips example (code available here), I can find this string

Solution 1:

On Android Developers Localise your app page, search for xliff in the section named "Mark message parts that should not be translated".

The explanation is as follows:

Often strings contain contain text that should not be translated into other languages. Common examples might be a piece of code, a placeholder for a value, a special symbol, or a name. As you prepare your strings for translation, look for and mark text that should remain as-is, without translation, so that the translator doesn't change it.

To mark text that should not be translated, use an placeholder tag.

The suggestion is that text within the <xliff:g></xliff:g> tags should not be translated. These tags can also provide metadata about the non-translated text.

When you declare a placeholder tag, always add an id attribute that explains what the placeholder is for. If your apps later replace the placeholder value, be sure to provide an example attribute to clarify the expected use.


For more information on the actual xliff tool, rather than how it relates to Android strings, check out the related question:

Post a Comment for "What's "msgid" And "xliff" In Strings.xml File?"