Get Started
This guide will help you set up and use Next Translator for your Next.js project. You can either create a new multilingual Next.js project or connect an existing project.
Prerequisites
Before you start, make sure you have:
- Node.js v20.0 or later
- npm package manager
- Basic knowledge of Next.js
- An account onNextTranslator
1. Create a New Next.js Project
With the web interface and our CLI tool, you can quickly create a multilingual Next.js application.
- 1Go to Create Project and create a new project.
- 2Add the languages you need (
Your Project → Menu → Languages
). - 3Run the following command in your terminal:
npx @pelag/nts create
Log in with your website account. The CLI will generate a Next.js project configured with the languages you selected.
2. Use an Existing Project
If you already have a Next.js project with some translation files, follow these steps:
- 1Go to Create Project and create a new project by uploading your existing JSON files.
- 2Install the CLI tool in your project:
npm install @pelag/nts
- 3Initialize the CLI:
npx nts init
This links your project with the Next Translator service and prepares it for syncing translations.
Updating Translations
After editing translations on the website, you can update your local project with:
npx nts update
This will download the latest translations and update your JSON files.
Key Files
When you create a project with npx @pelag/nts create
, the following files and folders are generated:
/lib/translator.ts
— project language configurationnts.config.json
— CLI tool configuration file/locales
— folder with translation JSON files
If you set up the CLI for an existing project, the most important file is:
nts.config.json
— make sure it has the correct path to your JSON translation files.