> For the complete documentation index, see [llms.txt](https://developers.weglot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.weglot.com/cms/javascript/advanced-concepts/translation-engines.md).

# Translation engines

Advanced concepts

In order to translate sentences properly, we are merging HTML nodes to keep words consistency. Weglot library is merging some nodes to avoid cutting your words and simplify your translation management.

### Example

Nothing to merge:

```markup
<p>This is an example</p>
<!-- This is an example -->
```

No merge:

```markup
<p>This is <b>an example</b></p>
<!-- This is -->
<!-- an example -->
```

Merging:

```markup
<p>This is <b>an example</b></p>
<!-- This is <b wg-1>an example</b> -->
```

### Translation engine versions

A translation engine version is set for each Weglot project. Old project has got translation engine 1, then 2. Now, all created project has translation engine version 3.

We need these version to not break already translated website. You can ask support to upgrade a translation engine version for a project if you need this, but it's at your own risks.

Here you can find all merging tags by translation engine version:

**Version 1**

No merging tag.

**Version 2**

* ABBR
* ACRONYM
* B
* BDO
* BIG
* CITE
* EM
* I
* KBD
* Q
* SMALL
* STRONG
* SUB
* SUP
* U

**Version 3** (project created since April 2019, 4th)

* A
* BDI
* BR
* DEL
* DFN
* INS
* S
* SPAN

### Add extra merged nodes

**With global option**

Weglot initialization snippet has an option to select your own merged nodes, in addition to those you have on your current version.

Example, in translation engine version 3:

```markup
<script src="..."></script>
<script>
Weglot.initialize({
    // ...
    extra_merged_selectors: ["code", ".merge-me-please"]
})
</script>

<!-- ... -->

<p>Use test of <code>extra_merge_selectors</code> option.</p>
<!-- Test use of <code wg-1>extra_merge_selectors</code> option. -->
```

**With HTML attribute**

Add a `data-wg-merge` attribute to elements you want to merge.

```markup
<p>Use test of <code data-wg-merge>extra_merge_selectors</code> option.</p>
<!-- Test use of <code wg-1>extra_merge_selectors</code> option. -->
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.weglot.com/cms/javascript/advanced-concepts/translation-engines.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
