gt-next@6.4.0
Overview
In gt-next 6.4.0, we've introduced locale aliasing. This feature allows users to override any canonical locale with an alias.
Setup
To support this, we've repurposed the code field in the customMapping parameter in the configuration. The alias locale is the locale used in your codebase. The canonical locale is the locale used in the API.
For example, General Translation uses zh instead of cn. If you want 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"
}
}Additionally, we have decided to move custom mapping from next.config.js to gt.config.json. This also allows other libraries (gtx-cli and gt-react) to use this feature.
Customisation
Because we are reusing the customMapping feature, you can further customise your alias locale. For example, say you want your cn alias to be labelled "Mandarin" instead of "Chinese":
"customMapping": {
"cn": {
"code": "zh",
"languageName": "Mandarin"
}
}