LingoHub supports Android .xml files, used for localizing Android applications.
LingoHub offers a tight coupling between Apple iOS and Android projects to speed up your multi mobile development. You just have to create one of these projects and export the translated resource files in the other format.
- this format is based on XML
- LingoHub supports string, string-array, plurals elements
- comments can be specified using XML syntax and will be assigned to the following key/value pair
- syntax for placeholders can be found here
Additional example files can be accessed here.
XML format related export rules
Rule: “&” and “<” have to be escaped using “&amp;” and “&lt;” unless they are used as escape sequence (e.g. &quot;) or element tag (e.g. <b>) otherwise the XML document is not well-formed!
Exception: if a strings element contains HTML (e.g. <u>) the behaviour depends on the HTML export setting:
- RAW: HTML tags will not be escaped at all, only the characters “&” and “<” will be escaped according to the rule above
- ESCAPE: all occurrences of “<“, “>” and “&” will be escaped, also for HTML tags
- CDATA: the content will be wrapped inside a CDATA section and no escaping using XML entities is done at all
In case the content is already wrapped in a CDATA section during import it will be exported inside a CDATA section as well irrespective of the HTML export setting!
Android related export rules
- Whenever a single quote (‘) character is in the content it has to be either escaped using “\'” or the whole string has to be quoted using double quotes (“)
- The character double quote (“) itself has to be escaped using “\””
- For a quoted text like ” this is some text ” no trimming will be done on import, i.e. the whitespace will be contained in the exported file as well!
- In case HTML tags (e.g. <b>, <i>, <u>) are present they are handled according to the HTML export settings, however if format strings (e.g. %1$d) are present as well all HTML tags will be escaped as if option export setting “ESCAPE” was selected!
- If format strings are used any other occurrences of “%” have to be escaped using the according unicode point representation (&#0025;), therefore the percent sign will always be escaped if not used as format String (e.g. “Save 50&#0025; only now!”). Exception: if the XML attribute ‘formatted = “false”‘ is present on the element no escaping of the percent sign is done!
- The characters “@” and “?” are escaped with “\” if they are at the beginning of the content (or represent the only content) unless the whole string is quoted using double quotes (“) as well or they represent references (e.g. in the form @string/keyName)
- Newlines are escaped using “\n”, Tabs are escaped using “\t”, the backslash character is escaped using “\\”
Additional export rules
- The rules under “Android related Export Rules” are always applied even if the content is inside a CDATA section (either because it was imported that way or a CDATA section is created because the according HTML export option is selected)
- In case the export option “Escape Unicode Characters” is selected in addition to the rules above all non-ASCII characters will be replaced by the according unicode point representation as well
- In case a non-unicode encoding (e.g. ASCII) is selected unicode escaping will be done implicitly
In typical Android projects these files do not need to have any
locale information in the filename (a typical name is
strings.xml). The locale information can be found in the path.
For that reason we always recommend to use our SCM integration to
synchronize your repository with LingoHub.
Otherwise you always have to specify the language in an additional step while importing this file.
See Supported Technologies.