i18nexus-cli

Command line interface (CLI) for accessing the i18nexus API

Usage no npm install needed!

<script type="module">
  import i18nexusCli from 'https://cdn.skypack.dev/i18nexus-cli';
</script>

README

i18nexus-cli

A command line interface for accessing translations from the i18nexus API

New to i18nexus?

i18nexus is a translation management web application designed for use with i18next. Learn more with this 5 minute React walkthrough or visit our Quick Integration guide.

Who is this CLI meant for?

  • Developers using SSR/SSG or libraries such as next-i18next
  • Developers who prefer to bundle their translation files with their app

The primary motivation for this CLI is to ease i18nexus integration with SSR/SSG frameworks such as NextJS. It is the best way to integrate i18nexus with next-i18next.

Setup

1. Installation

npm install -g i18nexus-cli

2. Downloading your translations

i18nexus pull -k <YOUR_PROJECT_API_KEY>

The above snippet will download all of your latest translations to your current directory in the following structure:

.
└── public
    └── locales
        ├── en
        |   └── common.json
        └── de
            └── common.json

This structure is i18next convention, and will work by default with next-i18next.

If you wish to download your files to a different directory, you can use the --path option to specify your download destination. See all options below:

Options

i18nexus pull

Option Default value
--api-key or -k
--path or -p ./public/locales
--ver or -v latest
--clean false

Details

--api-key Your project API key (Can also be set using environment variable I18NEXUS_API_KEY)

--path The path to the destination folder in which translation files will be downloaded

--ver The version of your project's translations to be downloaded (Can also be set using environment variable I18NEXUS_VERSION)

--clean Before download, clears your destination folder specified in --path. As a safety precaution, this only deletes folders with names that match a simple language code regex. You should still ensure you are not storing any files in your destination folder that you do not want deleted.