I'm a developer for more than 10 years, and one of my paint points was always the translation of my application. I generally work on multilingual applications, and I always had to wait until the end of the development to translate my application, and that was a pain. After struggling with this for a long time, I decided to automate the translation process.
So I created a tool that allows me to translate my application during the development process, and I want to share it with you.
The tool used DeepL api to translate the text, so before using it, you need to create an account on DeepL and get your API key.
Installation
To install the tool, you need to run the following command:
bash28 B
You can also install it from the source code by cloning the repository:
bash89 B
Usage
Before using the tool, you need to set your DeepL API key in the environment variable DEEPL_API_KEY. You can do this by running the following command in your terminal:
bash40 B
To use the tool, you need to run the following command:
bash114 B
- --input: Path to your source intl file (e.g., JSON, YAML)
- --output: Path to the output directory where translated files will be saved
- --type: The type of intl file (default is po, can be po, json, yaml)
- --srclang: Source language code (default is en)
- --lang: The target language code (e.g., fr, de, es)
This tool can be used to translate both PO and JSON files (for i18next, arb ...).
This saved me a lot of time and effort, and I hope it will do the same for you.
After translating, always check the result to ensure the translations are accurate and contextually appropriate.