Use key custom attributes to set format-specific options. Currently we support custom attributes for:
XLIFF
Android Resources
Java Properties
Index
Getting started
To get started, open your project and find a translation that you would like to provide custom attributes for. Click on the key name to bring up key editor:
Then navigate to the Custom attributes tab:
You'll be presented with a regular code editor where you can provide custom attributes:
Custom attributes specifics
XLIFF
Each key can have datatype
, notes
, and context-groups
attributes:
datatype
supports string values.notes
is an array of objects, each of those is a note. For each note the only mandatory field isvalue
.context-groups
is an array of objects, where each object is context-group containing an array that holds all contexts. We support an extra purpose field as well.
Example:
{
"notes": [
{
"from": "description",
"value": "Welcomes the user to the page",
"priority": "1"
},
{
"from": "meaning",
"value": "heading",
"priority": "1"
}
],
"datatype": "html",
"context-groups": [
{
"purpose": "location",
"contexts": [
{
"value": "app/app.component.ts",
"context-type": "sourcefile"
},
{
"value": "1",
"context-type": "linenumber"
}
]
}
]
}
Android Resources
This format supports the following attributes:
translatable
is an XML attribute for export, the value is eithertrue
orfalse
(make sure to specify it as string by enclosing it in quotation marks, e.g."false"
).force-cdata
is the parameter to enable when you are confident enough to override Lokalise's defaultCDATA
wrapper algorithm (which renders proper XML in most cases) for a particular key. Set this without quotation marks, as it is boolean, e.g.true
.android-tools
can contain any attributes described in Android's Tools Attributes Reference. The attribute's name must be specified without a prefix e.g. "ignore". The prefix will be added automatically and the namespace attribute will also be added automatically if any tools attribute is found for any key at the time of export.
{
"translatable": "false",
"force-cdata": true,
"android-tools": {
"ignore": "missingTranslation"
}
}
Java Properties
You can set a custom key-value separator for this file format. This is a legacy attribute, as currently you can set the separator on the Downloads page. The value must be either =
or :
.
Here's an example:
{
"separator": ":"
}
Combine them all
{
"separator": ":",
"translatable": "false",
"force-cdata": true,
"android-tools": {
"ignore": "missingTranslation"
},
"notes": [
{
"from": "description",
"value": "Welcomes the user to the page",
"priority": "1"
},
{
"from": "meaning",
"value": "heading",
"priority": "1"
}
],
"datatype": "html",
"context-groups": [
{
"purpose": "location",
"contexts": [
{
"value": "app/app.component.ts",
"context-type": "sourcefile"
},
{
"value": "1",
"context-type": "linenumber"
}
]
}
]
}