This guide explains how to add a new Locale to a project created using Next Right Now.
How to add a new locale
For instance, let’s say we want to add a new
fr-CA
locale.
Adding a new supportedLocales
In the src/i18ncConfig.js
, add the fr-CA
locale in the supportedLocales
array, as follows:
const supportedLocales = [
{ name: 'fr', lang: 'fr' },
{ name: 'fr-CA', lang: 'fr' }, // XXX New addition
{ name: 'en-US', lang: 'en' },
{ name: 'en', lang: 'en' },
];
This will immediately allow routes like /fr-CA/
to be used within the app.
Adapting your localization provider
You might also need to make some changes in your localization provider (e.g: Locize).
Locize
If you use Locize, you’ll need to create a new “Namespace” fr-CA
in your project.
There is an ongoing issue with the Locize implementation, see #200.