Xliff Tool For Xcode

Best Practices

Back to product home

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 and verification can use ML translation, local large models, or the online models configured in Xliff Tool. The following points describe the two local-first workflows:

ML Translation

Local LLM Translation

Verification Best Practices

There are two methods of verification: direct verification and cross-verification. Cross-verification is recommended.

Source Context

On macOS, when you open an Xcode .xcloc export, Xliff Tool can locate or let you choose the matching Xcode project. It can then show nearby source-code snippets, open their locations in Xcode, and use the context to help translate or verify strings.

For an online model, Xliff Tool asks for permission before sending these small snippets to the model server. You can decline and continue without source context. A local Ollama model can use the context through the local server.

The general process for translation is: export from Xcode, translate, verify the translation, and then import into Xcode.

  1. For familiar languages, you can use ML Translation followed by manual review and verification.

  2. 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.

  1. 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.