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

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 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, enclosing in quotes, 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 the particular key.  Set the without quotes, as it's boolean, e.g. true.
  • android-tools can contain any attributes described in Android's Tools Attributes Reference. Attribute's name must be specified without prefix e.g. "ignore". The prefix will be added automatically and the namespace attribute also will be added automatically if any tools attribute if found for any key in time of export.
{
    "translatable": "false",
    "force-cdata": true,
    "android-tools": {
        "ignore": "missingTranslation"
    }
}


Java Properties

You can set custom key-value separator for this file format. This is a legacy attribute, as currently you can set the separator at 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?