Published on
1 min read

gt-next@6.4.0

Authors

Overview

In gt-next 6.4.0, we've introduced locale aliasing. This little feature allows users to overwrite any canonical locale with an alias.


Setup

In order to facilitate 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"
  }
}

Additionally, 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.

Customization

Because we are reusing the customMapping feature, you can further customize your alias locale. For example, say that you want your cn alias to also be titled as "Mandarin" instead of "Chinese":

"customMapping": {
  "cn": {
    "code": "zh",
    "languageName": "Mandarin"
  }
}