gt-next@6.4.0
Overview
In gt-next 6.4.0, we've introduced locale aliasing. This small feature allows users to override any canonical locale with an alias.
Setup
To enable this, we've repurposed the code field in the customMapping parameter from the configuration. The alias locale is the locale that will be used in your codebase. The canonical locale is the locale that will be used in the API.
For example, General Translation uses zh instead of cn. If you wanted to use cn in your codebase for Chinese, then cn would be your alias locale and zh would be your canonical locale.
"customMapping": {
"cn": {
"code": "zh"
}
}In addition, we have decided to move custom mapping from next.config.js to gt.config.json. This allows other libraries (gtx-cli and gt-react) to make use of this feature as well.
Customisation
Because we are reusing the customMapping feature, you can further customise your alias locale. For example, suppose you want your cn alias to also be labelled as "Mandarin" instead of "Chinese":
"customMapping": {
"cn": {
"code": "zh",
"languageName": "Mandarin"
}
}