Skip to content

A tool that allows you to translate your i18n files in a simple and fast way. You can manually translate the files or use the Deepl API to translate them automatically.

License

Notifications You must be signed in to change notification settings

medanosol/translation-tool

Repository files navigation

translation-tool cover
@medanosol/translation-tool
The easiest way to translate your i18n files

Introduction

translation-tool allows you to translate your i18n files in a simple and fast way. You can manually translate the files or use the Deepl API to translate them automatically.

Why

The idea of this tool is to facilitate the translation of i18n files, since it is a tedious task to do it manually. As devs, we are always looking for ways to automate tasks and this is one of them.

Features

  • Translate your i18n files manually or automatically using the Deepl API.
  • Translate all your keys at once or translate them one by one.
  • Upload partially translated files and the tool will automatically detect the translated keys and will not translate them again.

Install

Install the package using your favorite package manager.

With yarn

yarn add @medanosol/translation-tool --dev

With npm

npm install @medanosol/translation-tool -D

Getting started

Once you have installed the package, add the following command to your package.json file.

"scripts": {
  "translate": "translation-tool"
}

Then, when you run the command yarn translate or npm run translate, the tool will start at port 3000 by default. You can change the port by adding the following command to your package.json file.

"scripts": {
  "translate": "translation-tool --port 3001"
}

How to use

You just need to add the API key before you start trasnlating your files. If you want to skip doing this every time you open the tool, we added a way to save your API key in the browser's local storage. To do this, just click on the "Save API Key" button and the next time you open the tool, it will automatically load your API key. It's encrypted, so don't worry about security. If you still don't feel safe, you can always delete it from the local storage and add it manually every time you open the tool.

demo-image

Setting up the Deepl API

To use the Deepl API, you need to create an account on their website and get an API key. You can create an account here: Deepl API. Their free plan allows you to translate 500,000 characters per month, so for most projects it will be more than enough.

Adding your i18n files

Initially you will be asqued to set the origin language of your file. After you do that, you will be able to upload your i18n file.

adding files

Translating your files

If you have set up the Deepl API, you can translate your files automatically. If you haven't, you can translate them manually. To do this, just click on the "Translate all" button and the tool will start translating your file. If you want to translate a specific key, you can do it by clicking on the button next to the key.

Uploading partially translated files

In case you have already translated some of your files, you can upload them to the tool and it will automatically detect the translated keys and will not translate them again. Remember that you have to set which is the desired language of the file before translating it.

Downloading your files

Once you have translated your files, you can download them by clicking on the "Save file" button. The tool will automatically download a json file with all your translations.

You can also copy the json file to your clipboard by clicking on the "Copy to clipboard" button.

Supported languages

Manually, you can translate your i18n files to any language you want. But if you want to use the Deepl API, you can only translate languages listed on the Deepl API Documentation: Deepl API Docs

License

MIT License

About

A tool that allows you to translate your i18n files in a simple and fast way. You can manually translate the files or use the Deepl API to translate them automatically.

Topics

Resources

License

Stars

Watchers

Forks