Static Translations
A static translation is any piece of content defined on the system level and can not be modified neither from the system setup nor the configuration process.
Static translations are button labels, system page titles, and error messages.
Refer to resource translations to learn how to translate configurable content.
Modify static translations
Fork the corteza-locale repository
The corteza-locale repository provides a centralized storage for all translations used by Corteza.
You can use the repository in question as a base when defining additional languages or modifying existing translations.
Modify the translations
All of the translations are located in the src
directory of the corteza-locale repository.
Translations are grouped by the language, and the repository that they are used in.
The language must be defined in the Corteza server configuration in order for it to be available. Refer to the DevOps guide of details. |
Refer to the modifying translation files for details on how the resource files should be structured.
Refer to the supporting new languages for details on how to define additional languages.
Deploying modified translations
Upload the modified translation files to your Corteza server. Refer to the DevOps guide for details.
Modifying translation files
📁 src
📁 <language tag> (1)
📁 <corteza repository> (2)
📄 <locale namespace file>.yaml (3)
1 | The directory must be named with the language tag of the contents. The language tag must follow the BCP-47 standard. |
2 | The directory must be named the same as the repository in which it will be used in.
To examplify; translations used by Corteza Low Code is named as corteza-webapp-compose . |
3 | The file contains a series of translations that are grouped in a locale namespace. |
Locale namespaces are not the same thing as Corteza Low Code namespaces. There is no correlation. |
A locale namespace encapsulates content that falls into the common area, such as the sidebar, notifications, module fields.
For the complete list of locale namespaces used by a specific web application take English translations as a reference. You can also inspect web application i18n plugin initialization code:
|
en/corteza-webapp-compose/chart.yaml
file:colorLabel: '{{count}} colors'
colorScheme: Color scheme
configure:
reportsLabel: Reports
general:
label:
title: Label
add: Add
value: Value
placeholder:
handle: handle (a - z, 0 - 9, underscore, dash)
// ...
Supporting new languages
📁 src
📁 <language tag> (1)
1 | The directory must be named with the language tag of the contents. The language tag must follow the BCP-47 standard. |
To support an entirely new language, create a new directory in the src
directory.
For example, to add Italian translations, you would need to create a directory named it
in the src
directory.
Languages can be defined using a simple language tag, such as en
and sl
.
If you need to be more specific you can use region suffix, such as en-US
and en-UK
.
Corteza will try to detect the language from the request headers and serve appropriate translation.
it
folder:📁 src
📁 en (1)
📁 it (2)
1 | This is the default directory with all of the English translations. |
2 | This is the newly created directory for the Italian translations. |
Inside the newly created directory create a config.yaml
file.
The config.yaml
file defines some base properties of the language, such as the display label (the name
property).
Refer to the schema/config.json
file for details.
config.yaml
file contents:name: English
config.yaml
file:📁 src
📁 en
📁 it
📄 config.yaml (1)
1 | This is the configuration file that describes the given language. |
After defining the boilerplate bits, refer to the predefined English translations (located in the /src/en
directory) for all of the available translations.