In our app directory, all we have to do is run i18nexus pull
with our API key and all of our latest translations will be downloaded to our project directory!
$ i18nexus pull --api-key <YOUR_API_KEY>
Now all our translations will be located in public/locales
, which is where next-i18next
expects them.
We can also add our API key as an environment variable named I18NEXUS_API_KEY
so that we can just use i18nexus pull
without typing your API key every time.
To do this, we simply create an environment variable file called .env
at the root of our app that containsI18NEXUS_API_KEY=YOUR_API_KEY.
Bonus Points:
If we want to automatically pull our latest translations every time we start up our dev server or build our app, all we have to do is update our scripts in package.json
:
package.json