Skip to main content
All CollectionsKeys and filesTranslation files
Create a translation memory for existing translations (translation alignment)
Create a translation memory for existing translations (translation alignment)

Learn how Lokalise can easily align your texts when importing both the base and target versions to the project.

Ilya Krukowski avatar
Written by Ilya Krukowski
Updated over 4 months ago

This feature is available for Marketing and support as well as Ad hoc documents project types.

When starting with Lokalise, you might already have content translated into various languages, such as blog posts, email templates, or standard HTML files. This content, which fits within the scope of Marketing and support or Ad hoc documents projects, often doesn’t match the original versions exactly. For example, a translated blog post might include extra empty paragraphs or have a slightly different layout.

When you import both the original and translated versions of your content into Lokalise, a sophisticated machine-learning model accurately aligns the base text with its translations. This eliminates the need for manual adjustments, ensuring that even with additional or missing paragraphs in the translated version, all text elements are correctly linked to the original.

Additionally, once you import your source and translated content into Lokalise, the system automatically adds the extracted entries to the translation memory.

Typical use cases

The translation alignment feature is especially valuable in the following scenarios:

  • Managing multiple language versions of the same content with identical layouts: This ensures that translations align perfectly with the original content, even when the structure is the same across all languages.

  • Handling language versions with different layouts: For example, one version might replace an unordered list with paragraphs or substitute a table with a block of text. The alignment feature ensures that these structural changes don’t affect the accuracy of the translation mapping.

  • Addressing missing translations in the target versions: In cases where certain elements, like an unordered list in the base content, are missing from the translated file, the alignment feature still accurately links the remaining content to the original text.


Seeing it in action

To see the translation alignment feature in action, let’s use two simple HTML files that represent onboarding email templates in English and Spanish.

Example files

English

Spanish

<h1>Welcome onboard!</h1>

<p>We are thrilled to welcome you! Here are some links to help you get started:</p>

<ul>
<li>Documentation</li>
<li>Blog</li>
<li>Forum</li>
</ul>
<h1>¡La bienvenida a bordo!</h1>

<p>¡Estamos encantados de darle la bienvenida! Aquí hay algunos enlaces que le ayudarán a empezar:</p>

<p></p>
<p></p>
<p>Documentación</p>
<p>Foro</p>

If you're not familiar with HTML, don't worry. The key takeaway here is that we have a header, a paragraph, and a list of items that we want to upload to Lokalise. The overall content layout appears nearly identical between the two versions, but there are some differences:

  • The Spanish version contains only two items in the list (Documentación and Foro), compared to three in the English version (Documentation, Blog, and Forum).

  • The Spanish version has extra empty paragraphs (<p></p>), and the HTML structure differs slightly.

Uploading files

Now, let's see what happens when we upload these two files to Lokalise.

Go to the Upload page and add both the English and Spanish files (alternatively, you can upload the English version first, followed by the Spanish file).

Upon uploading, you’ll notice that Lokalise detects 6 keys in the English file but only 5 keys in the Spanish file. This is because empty tags, like <p></p>, are automatically ignored.

Click Import files to proceed to the Editor.

Translations in the editor

In the Editor, you’ll see that the list items have been properly aligned despite the differences in structure.

The empty tags from the Spanish file have been discarded. However, you’ll notice there’s no translation for the "Blog" item because it was missing from the Spanish template. You can easily add this missing translation to fill any gaps.


Checking results of the translation alignment

After importing your files, the keys might not always align perfectly, especially if the base and target versions differ significantly. To identify and resolve potential issues, we recommend the following steps:

  1. Enable QA checks in your project settings. This allows you to detect and address common alignment problems. Once enabled, use the Filter dropdown to locate keys with QA issues. The most useful QA checks include:

    • Inconsistent placeholders

    • Inconsistent HTML

    • Different numbers

    • Different URLs

    • Different emails

    • Different brackets

  2. Use the Filter dropdown to find all Untranslated keys. It’s often easiest to review one language at a time by deselecting the other languages in the language filter. This helps you identify keys that are missing translations in the target language. Common reasons for missing translations include:

    • Undetected translations: The corresponding translation wasn’t found in the target file.

    • Merged paragraphs: The base content might have two separate paragraphs, but the target has only one merged paragraph. For example, this could happen if the base version has two distinct <p> tags, but the translator mistakenly merged the content using a line break (<br>) in the target version. In this case, you’ll need to manually split the target text. To identify this issue, you can search for <br> or <br><br> within your content on Lokalise.

  3. Carefully review entries (files) with many untranslated keys. A high number of untranslated keys may indicate that the imported target version is not a true translation but rather a completely different piece of content.


Important notes

Translation memory in existing teams

If your team heavily relies on translation memory and it’s already populated with content, exercise caution when importing large volumes of new content. The translation memory will automatically be updated after the import, and if something goes wrong, your memory could be filled with many invalid entries that are difficult to remove.

To prevent this, when adopting this feature and importing large portions of content to an existing team, it’s advisable to create a separate translation memory storage to use within the new project.

Here’s how to do it:

  • Open the Team settings.

  • Go to the Translation memory tab and click Create new TM.

  • Give your new translation memory a name and click Create TM.

  • Next, create a new project (either Marketing and support or Ad-hoc documents type). Before importing content, open the project settings.

  • In the Translation memory target dropdown, select the newly created TM. This ensures that all new entries will be saved to this translation memory.

  • Click Save changes at the bottom of the page. Now, all content imported into this project will be stored in the new translation memory without affecting your existing entries.

Missing content

If your target content includes elements that aren’t present in the base version, those extra elements will be ignored during the import. Lokalise supports content versions with similar layouts; the number of paragraphs, headers, and other block-level components should be roughly the same.

For example, suppose your English HTML file has only one paragraph, while the Spanish version has two:

English

Spanish

<p>Welcome!</p>
<p>¡La bienvenida a bordo!</p>

<p>¡Estamos encantados de darle la bienvenida!</p>

In this case, the second paragraph in the Spanish version will be ignored because it doesn’t match any text in the base version.

The base layout is used

Lokalise will align content even if the layouts differ slightly between versions, but the exported translations will always follow the layout of the base version.

For instance, if your English HTML file has a list and the Spanish version presents the same items as regular paragraphs:

English

Spanish

<ul>
<li>Documentation</li>
<li>Blog</li>
<li>Forum</li>
</ul>
<p>Documentación</p>
<p>Blog</p>
<p>Foro</p>

The content will align correctly, but when you export the Spanish version, the paragraphs will be converted into an unordered list to match the base version's layout.

In summary, Lokalise enforces a consistent layout across all languages, following the structure provided by the base language.

Transcreated content might not be aligned properly

If your target content includes transcreated texts (i.e., content adapted rather than directly translated), the alignment algorithm may struggle to match the base and target texts because the messaging differs too much.

For example, consider the following English paragraph and its Spanish version:

English

Spanish

<p>Welcome!</p>
<p>Me alegra darle la bienvenida en este maravilloso día.</p>

While the Spanish text conveys the original message, it’s not a direct translation and deviates significantly from the base text. In such cases, Lokalise may not be able to align the target text with the base, resulting in the Spanish content being ignored during the import.

Did this answer your question?