Language | Guidelines |
---|---|
English (en) | README |
Chinese Traditional (zh-TW) | README_zh-TW |
Czech (cs) | README_cs |
This tool supports the xliff(1.2) format and performs XLIFF translation through external AI services (such as ChatGPT).
In this example, we use Crowdin. Choose "Export in XLIFF" from your project, then download the file.
java -jar xliff-trans-x.x.x.jar
Select the appropriate file for your operating system:
This program is written in Java and requires JDK1.8 or JRE8 or later versions. If JDK8 or above is not installed, please first visit Java download
xliff-trans-0.1.1.zip
If you have Java 8 or higher installed, download:
xliff-trans-x.x.x-macos.tar.gz
If you do not have Java 8 or higher, or are unsure, download the version that includes the Java runtime:
xliff-trans-x.x.x-macos-withJRE.tar.gz
This program is written in Java and requires JDK1.8 or JRE8 or later versions. If JDK8 or above is not installed, please first visit Java download
xliff-trans-x.x.x.tar.gz
After downloading, please extract the files first.
If you plan to use AI-based token translation, write the target language and specify any translation terms or tone in the prefix_promp.txt.
Note: The quality of your translation depends on the AI model and your promp, so make sure to input the desired translation style fully in the prefix_promp.txt.
Enter your OpenAI key token (additional fees apply). Follow this video for setup: Watch the video
After obtaining the api_key, enter it in Config.properties
api_key=sk-proj-xxxxxxxxxxxxxxxxxxxxxx
If you need to modify the AI model, specify it here
model_version=gpt-4o-mini
Note: The models you can use depend on the Usage tiers. If you've paid $5, you can be a Tier1 user. See Tier1 details here.
Run:
run.bat
Note: Windows may display a security warning. Click "More info" => "Run anyway".
Run:
./run_macos.sh
or
./run_macos_withJRE.sh
Run:
java -cp . -jar xliff-trans-0.1.1.jar
After starting the program, you will see file path selections, action buttons, and log output at the bottom. First, choose the path of the XLIFF file you want to translate (e.g., /path/xxx.xliff).
Select the XLIFF file path and press "Step 1". The program will extract text with the needs-transcate attribute and save it to /path/xxx.xliff_source_text.txt. This will contain only
Copy paragraphs (suggested 100 lines) from /path/xxx.xliff_source.txt, paste them into the ChatGPT conversation. Depending on your model, translation speed and accuracy may vary. For example, using GPT-4o, paste 100 lines at a time, wait for the result, and then save the result to /path/xxx.xliff_target.txt.
Method 2: Use the OpenAI API (Additional fees apply):
You need to bind a credit card and generate an API token. > Note: Make sure you've entered the api_key, refer to 3. AI Translation Setup (Optional)
In the prefix_promp.txt, specify the target language and mention any specific translation rules for terms. Once everything is ready, press "Step 2" to send 50 lines of text to OpenAI at a time, using the default GPT-4o-mini. The result will be saved in /path/xxx.xliff_target.txt.
Non-source tag data will be skipped in "Step 3", so if incorrect XML structures occur, you can ignore them. API usage fees can be tracked at https://platform.openai.com/usage (updates may have a few minutes delay).
Click "Step 3" to merge the translation from /path/xxx.xliff_target.txt into the original XLIFF file based on the ID, then save it as /path/xxx.xliff_update.xliff and change the target attribute to translated
<target state="translated">xxxxxx</target>
Upload the /path/xxx.xliff_update.xliff to Crowdin and check the results.