Resolving Translation Index Conflicts
How to avoid conflicts in the translation index and how to resolve them when two translation jobs or two branches record translations independently.
The translation index is a single file that every translation job updates. Its format is designed to make conflicts rare because entries are written one per line, kept sorted, and can be split across fragments. However, a conflict can still occur when the same region of the file is changed by two parallel jobs.
The usual cause is that a translation job works on a snapshot of your workspace taken when the job starts. A job does not see the entries that another job records while it is running, and it returns an index that contains only its own entries. If you bring in the results of two such jobs, or merge two branches that each recorded translations, both versions of the index are legitimate, and each one is missing the other's entries.
Preferred: Run One Job at a Time
The simplest way to keep the index conflict-free is to avoid having two jobs produce translations at the same time:
- Put everything in the same job. In the New translation dialog box, select all the publications and all the target languages that you want to update. A single job covers all of them and processes the languages one after another, updating one index as it goes, so there is nothing to merge afterward.
- If you do need several jobs, finish one before starting the next. Bring the results of the first job into your workspace, review them, and commit them. Only then start the second job so that it starts from a workspace that already contains the entries from the first one.
Running translation jobs in parallel is not advisable, and not only because of the index. A job cannot reuse the topics that another job is translating at the same time, so parallel jobs repeat work that a single job would have done once, and they cannot keep their terminology consistent with each other.
Keeping the Entries of Both Jobs After the Fact
If two jobs have already run in parallel, you can still combine their results, one job at a time:
- Bring the first job into your workspace, review it, and commit it as usual.
- Bring the second job into your workspace. Because the index in your workspace is now the one committed for the first job, the Import conflict dialog box does not appear for it, and the imported index replaces the committed one.
- Open the Changes view and select translation-index.xml. The comparison shows the version imported by the second job on the left and the committed version from the first job on the right. Edit the left side so that it keeps the entries from both versions, then commit.
This is easier than it sounds because the two versions differ only
by whole <entry> elements, one per line. None of the lines that both
jobs produced needs to be reconciled word by word. Keep every entry that appears on either
side, and keep the entries sorted.
Translating on Separate Branches
When translations are produced on different branches, for example one branch per language or per product area, the index conflict appears when you merge. Use the Merge into current branch action and resolve the conflict with the branch merging conflict resolution dialog box:
- For translation-index.xml, choose Manual merge and edit the merged version so that it contains the entries from both branches. Do not choose Keep main changes or Keep dev changes, because either one discards the entries recorded on the other branch and the corresponding files are translated again in the next job.
- If the same topic was translated into the same language on both branches, the translated file itself also conflicts. Resolve that conflict, then delete the entry for that topic from the merged index and retranslate the topic after the merge.
If you regularly work on separate branches, consider splitting
the index into fragments, one per language or per product area, by using <include
href="..."/> pointers. Each branch then updates a different file, and the merge
has nothing to reconcile. See the file
format reference.
Checking the Result
After you resolve a conflict, make sure that the index is still
well-formed XML and that no entry is duplicated for the same (language, source
file) pair. The next translation job reports any file whose entry is missing as
missing or stale, which is a convenient way to confirm that the merge kept
what you expected. See Running an Incremental
Translation.