Best Practices
This document serves as a best practices guide for developers and users of the Xliff Tool. The aim of this guide is to harness the full potential of the Xliff Tool. Use this guide as a reference and integrate it into your workflow.
Translation Best Practices
Translation can be done in two modes: machine learning (ML) translation or local large model-based translation. The former is preferred as follows:
ML Translation
- No additional costs.
- When operating offline, the translation is entirely local, ensuring strong privacy.
- The translation is a direct one, with high accuracy.
- The translation speed is fast.
Local LLM Translation
- No additional costs.
- The translation is conducted locally, ensuring strong privacy.
- The translation can be refined with prompt words, but the quality can be inconsistent due to the limitations of the local LLMs, which are usually restricted versions. There may even be instances where translation into the target language is not possible.
- Different models have varying levels of translation quality for different languages, which may require searching to find the most suitable one.
- The translation speed varies depending on the machine configuration and the size of the selected model, but it is generally the slower than ML translation.
Verification Best Practices
There are two methods of verification: direct verification and cross-verification. Cross-verification is recommended.
Grammar Check Best Practices
When using Ollama for grammar checking, it is important to ensure that the selected model supports the language you are working with. This information can typically be found in the technical documentation of the model.
Recommended Process
The general process for translation is: export from Xcode, translate, verify the translation, and then import into Xcode.
- For familiar languages, you can use ML Translation followed by manual review and verification.
- For unfamiliar languages, you can use ML Translation and then verify through a LLM. LLM verification can be improved in accuracy through cross-verification.
LLM cross-verification involves verifying the translation using an already verified target, rather than the source.
For example, the English word "check" has two meanings: to inspect and a bank check. Suppose we need to translate the English word "check" into Japanese. During verification, relying solely on the source "check" does not inform us whether the translation into Japanese should be "inspection" or "bank check." In such cases, we can use an already verified third-party for verification. For instance, if we already have an English to Chinese translation, we can use the Chinese translation to verify the Japanese. If the Chinese is "inspection" but the Japanese is "bank check," it indicates an error in the Japanese translation that requires manual correction.
Below is a detailed description of the translation steps.
1. Export Multilingual Files from Xcode to the Xliff Tool Folder in iCloud
Xliff Tool uses CloudKit to synchronize its internal database, which does not include the xcloc files exported from Xcode. Therefore, if you also want to synchronize these files, you need to place them in a folder that can be automatically synchronized. Xliff Tool has created a dedicated application folder in iCloud Drive, which is recommended for use.
You can also use other synchronization services, such as Dropbox or OneDrive.
2. Open the File that Needs to Be Translated
3. AI Translation
It is recommended to download offline translation packs for commonly used languages on macOS. This can improve the translation speed. For specific usage, you can refer to this article: Using ML Translation.
LLM translations sometimes over-interpret the content to be translated. Therefore, more effort is needed during verification.
4. Review the Translation
For familiar languages, it is recommended to use manual review to maximize accuracy. Additionally, the results of manual review can also be used for LLM cross-verification, thereby improving the accuracy of translations for languages that users are not familiar with.
For unfamiliar languages, LLM cross-verification can be used.
On macOS, users can confirm the review using cmd + enter.
On iOS/iPadOS, users can swipe left above the target text editing view to confirm the review.
5. Save
After all translations are completed, users can save the results.
Saving can be done at any time. If the translation is incomplete, the saved result will be partial. It is important to note that even if not all translations are confirmed, as long as the content has been translated, it will be saved. However, at this point, what is obtained is only the translated content, not the final result after confirmation and modification.
- Import the Translated Multilingual Files into Xcode, and the Translation Is Complete.
About Synchronization
Xliff Tool requires synchronization of two parts of data. One part is the multilingual files exported from Xcode; the other part is the internal database stored by Xliff Tool.
For the former, Xliff Tool does not handle synchronization, but it has created a dedicated folder in iCloud Drive, which you can use. It is automatically synchronized by iCloud. You can also use other synchronization solutions.
For the latter, Xliff Tool uses CloudKit for synchronization.
If you open the same file on multiple devices at the same time, the default behavior is to prompt you for operations in the same order on both, and any translation or confirmation you make on one will be reflected on the other.
Grammar Check
The Xliff Tool 4.0 version has added a grammar check feature, which includes two parts of functionality.
Literal Check
The literal check refers to translations where the source and target are the same in all languages. Such words should be removed from the translation file as they do not need to be translated. In SwiftUI, you can use a method like Text(verbatim: "666") to prevent text from being translated.
Clicking on the text allows you to copy it to the clipboard.
If you have adopted the latest String Catalog feature in Xcode, you may encounter issues when using the literal check. Code changes you have made in Xcode, such as Text(verbatim: "666"), will still appear in the translation. According to our investigation, this is a problem with the String Catalog. The solution is to delete the String Catalog and then re-export the multilingual files.
An alternative method is to delete the String Catalog and then add a new one.
Long Sentence Check
The long sentence check can verify the spelling and grammar of sentences. It uses a LLM for grammar checking. To improve accuracy, Xliff Tool allows you to use up to three different LLMs for comprehensive comparison.
Language checks focus on issues with the source. Therefore, after identifying issues, you need to make modifications to the source in Xcode and then re-export the file that needs to be translated.
The literal check can only be performed after the translation is complete.
The long sentence check needs to be performed from the beginning.
Copyright © 2017 ParusSoft.com