A tool to automate the translation process of react/i18-next projects.
NOTE: This tool was created during a hackathon. Therefore,
code quality, tests, error handling, etc. might have suffered to get a usable version of this tool done as quickly as possible.
This tool can semi-automates the translation process by providing the following features:
- Auto-detect new translation keys in a react/i18n-next project
- Auto-translating translations provided by a user to all available languages
- Posting the generated translations in a Slack channel of the users choice
- Uploading the translation keys and generated translations to SimpleLocalize
Since this tool is written in Scala (and a bit of Java) it runs on the JVM. Therefore, you must have a Java Runtime Environment (JRE) installed.
After downloading the JAR file, you can invoke it via
java -jar path/to/the/jar/auto-translate.jar
If you plan on using this tool frequently, it might be easier for you to place the following script in
a directory that is included in your $PATH
(e.g /usr/local/bin
):
#!/bin/bash
java -jar path/to/the/jar/auto-translate.jar $@
Name this script auto-translate
and mark it executable (via chmod u+x auto-translate
)
You can then invoke the tool by just typing auto-translate
The tool is used in three phases:
When using the tool in a new project, run auto-translate init
in the project directory.
This will create a folder .auto-translate/
that contains the configuration file skeleton config.json
Before continuing, provide the necessary information in the config file.
Before starting to work on the project, take a snapshot of the translation keys that are already available via
auto-translate snapshot
You can now add a few translations in the code and run the automated translations via
auto-translate run