FREE! Translate your language JSON file to any languages.
Tags: javascript, localization, frontend, translation
Published: 2022-01-10 01:10:09

_Hello everyone. It is my first time writing a post here. Please feel free to give any kind of feedback._

I created a package & CLI for translating JSON files and also objects (if you want to use it in the code) into different languages in an **amazingly fast and FREE way**. It uses Google Translate API for translation. Normally translate APIs are not FREE. But the json-translator is fully FREE to use. No need for any key configuration or something.
[github.com/ParvinEyvazov/json-translator](https://github.com/ParvinEyvazov/json-translator)
 (don't forget to leave a star⭐)
![CLI usage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2bi5yr8ahcknissn9okw.gif)


Language localization in both web and mobile applications is happening in the front-end generally. And in most cases, every language has a specific JSON file that contains all texts of an app. And according to the language that the user preferred, the app fetches specific text and shows it.

## What was the problem?
When you want to add new language support to your application, you need to translate the whole of your values from your JSON file one by one and create a new JSON file to store them for this new language. And when you want to add multiple languages, it can become a nightmare for the person who will do this.

## How does this package solve this problem?
By using json-translator, you don't need to create new files and translate the whole content manually. You just need to say the CLI that which language or languages that you want to add to your languages folder. And CLI will translate your whole content or values to these languages and create new files for them to store.

---

## How to use it?
- First, we need to install the package. (make sure Node is installed in your system) `-g` is for installing globally.

```bash
npm i -g @parvineyvazov/json-translator
```


### How to use CLI?

- Run this command:
```bash
jsontt path/to/your/file.json
```

- Then select the language of your original JSON file. Also, you can select `Automatic` to detect your original language automatically.
- Then select the languages that you want it to translate. You have to select them with a `space bar`.
- BOOM! They are ready.

</br>

The result will be in the same folder as the original JSON file.

![CLI usage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2bi5yr8ahcknissn9okw.gif
)

Also, this kind of usage is acceptable:
```bash
jsontt file.json
```
```bash
jsontt folder/file.json
```
```bash
jsontt "folder\file.json"
```
```bash
jsontt "C:\folder1\folder\en.json"
```

### Supported languages
You can reach the supported languages from [here](https://github.com/ParvinEyvazov/json-translator/blob/master/docs/LANGUAGES.md#supported-languages-).

---

## What else?
You can also use json-translator as a package to translate your **JSON objects and files in the code**. But now, the package is not Browser compatible. You can use it only in node projects. For how to use in code, please read the official README file from [here](https://github.com/ParvinEyvazov/json-translator#-usage).

I hope this package will be helpful for your current and future projects to accelerate language processes. 
**Thanks for reading and have a wonderful day :)**