Please note that the segmentation feature is still in beta.

Segmentation is a fairly complex feature and it has certain edge cases. This article sums up a few scenarios that you may encounter when updating segmented content. Remember that the number of segments can be changed for the base language only, and the other languages comply with existing segment count.

Segment misalignment during import

It may happen that upon importing, the target language contains more or fewer segments than the base language.

If the target language has fewer segments, then the last segments for this language will become empty. If there are more, the last segments will automatically be merged into a single one:

An extra segment is added at the end

When you append a new segment for the base language, the target languages will also have a new empty segment appended:

The last segment becomes empty

If you modify segments for the base language, the target language segments become unverified automatically:

A new segment is added to the top or middle (or removed)

This scenario is a bit more complex. Suppose we have an English translation file in the YAML format, for instance:

---
en:
welcome_block: |-
<article>
<p>Welcome to <strong>My sample corp</strong>!</p>
<p>We are happy to have you on board.</p>

<section>Learn about us:<ul>
<li><a href="/ceo">CEO</a></li>
<li><a href="/cto">CTO</a></li>
</ul>
</section>

</article>

In this file, we have a single key, welcome_block, with some block and inline tags. We upload this file to our project, the text gets segmented properly, and then we also provide some French translations. Here's the result:

Next, imagine we are updating our YAML translation file and adding a new div tag with a special offer to the very beginning:

---
en:
welcome_block: |-
<div>A special offer for you!</div>
<article>
<p>Welcome to <strong>My sample corp</strong>!
<br> We are happy to have you on board.</p>

<section>Learn about us:<ul>
<li><a href="/ceo">CEO</a></li>
<li><a href="/cto">CTO</a></li>
</ul>
</section>

</article>

We upload this translation file again and check the Update modified translations upload option.

Here's what happens after this import:

Basically, the segments are now misaligned because the second segment in English corresponds to the first segment in French! Here's a diagram illustrating this scenario:

Something very similar will happen if you try to add new segments to the middle or remove segments — your segments will become misaligned again:

So, be very careful when importing your files and adding or removing segments!

To overcome this problem, we recommend using automations. Specifically, set up the following rule for your segmented project (please note that English is the base language here):

Now whenever a change is made, this rule will automatically update all the affected segments and apply a translation memory to them. This way, your segments will be aligned properly. Don't forget to check the Enable automations option when uploading your translation files to trigger this rule!

Did this answer your question?