Use key's custom attributes for to set format-specific options. For example, Android Resources (XML) files can have the attribute "translatable" set to "false".  Click the key name in the editor to bring up the key editor. Navigate to the Custom attributes tab.

Currently we support custom attributes for:

  • XLIFF
  • Android Resources
  • Java Properties

XLIFF

Each key can have datatype, notes and context-groups. See example for usage.

  • datatype has a string value.
  • notes is an array of objects, each of those is a note. For each note the only mandatory field is value.
  • 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 

For this format you can use two attributes – translatable and force-cdata.

  • translatable is an XML attribute for export, the value is either "true" or "false" (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 default CDATA 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,
    "formatted": false,
    "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 :

{
    "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"
                }
            ]
        }
    ]
}
Did this answer your question?