Language Key Convention
This feature refers to the labels.xlf file.
The translation keys follow a convention and are registered automatically. This feature is available for the following options (more may come).
- element title
- element description
- Field label
- Field description
- Palette label
- Palette description
- Tab
- FlexForm Sheets
- FlexForm Container
It is also possible to translate the items
option of
Select, Radio
and Checkbox fields.
The convention is best explained by examples. Have a look at the example beneath.
Note
Labels defined in labels.xlf will always override label
defined in
config.yaml.
Workflow
The recommended workflow is defining the label
in the config.yaml first.
When you are done, you run the command to
auto-generate the labels.xlf file. After that you can remove the labels from the
yaml definition. You can also skip the first step and generate the xlf without
defining labels first. This will add the identifier
as label and you can
adjust it afterwards. Either way, it is recommended to maintain a labels.xlf
file so you don't mix labels with configuration.
Convention schema
The schema below displays most common conventions. Text in uppercase refers to
values defined in identifier
.
Tip
You don't have to remember all these rules. The command content-blocks:language:generate creates the labels.xlf file with all available keys for you.
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file datatype="plaintext" original="labels.xlf" source-language="en" product-name="example">
<header/>
<body>
<!-- Title and description of the Content Type -->
<trans-unit id="title">
<source>This is the Content Type backend title</source>
</trans-unit>
<trans-unit id="description">
<source>This is the Content Type backend description</source>
</trans-unit>
<!-- Field labels and descriptions for the backend -->
<trans-unit id="FIELD_IDENTIFIER.label">
<source>This is the backend label for FIELD_IDENTIFIER</source>
</trans-unit>
<trans-unit id="FIELD_IDENTIFIER.description">
<source>This is the backend description for FIELD_IDENTIFIER</source>
</trans-unit>
<!-- Collections add another nesting level -->
<trans-unit id="COLLECTION_IDENTIFIER.FIELD_IDENTIFIER.label">
<source>This is the backend label for FIELD_IDENTIFIER in Collection COLLECTION_IDENTIFIER</source>
</trans-unit>
<!-- Palette labels and descriptions -->
<trans-unit id="palettes.PALETTE_IDENTIFIER.label">
<source>Label for Palette</source>
</trans-unit>
<trans-unit id="palettes.PALETTE_IDENTIFIER.description">
<source>Description for Palette</source>
</trans-unit>
<!-- Palettes inside Collections -->
<trans-unit id="COLLECTION_IDENTIFIER.palettes.PALETTE_IDENTIFIER.label">
<source>Label for Palette in Collection</source>
</trans-unit>
<trans-unit id="COLLECTION_IDENTIFIER1.COLLECTION_IDENTIFIER2.palettes.PALETTE_IDENTIFIER.label">
<source>Label for Palette in nested Collection</source>
</trans-unit>
<!-- Tab labels -->
<trans-unit id="tabs.TAB_IDENTIFIER">
<source>Label for Tab</source>
</trans-unit>
<!-- Tab labels inside Collections -->
<trans-unit id="COLLECTION_IDENTIFIER.tabs.TAB_IDENTIFIER">
<source>Label for Tab in Collection</source>
</trans-unit>
<trans-unit id="COLLECTION_IDENTIFIER1.COLLECTION_IDENTIFIER2.tabs.TAB_IDENTIFIER">
<source>Label for Tab in nested Collection</source>
</trans-unit>
</body>
</file>
</xliff>