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:
1
<p>This is an example</p>
2
<!-- This is an example -->
Copied!
No merge:
1
<p>This is <b>an example</b></p>
2
<!-- This is -->
3
<!-- an example -->
Copied!
Merging:
1
<p>This is <b>an example</b></p>
2
<!-- This is <b wg-1>an example</b> -->
Copied!

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:
1
<script src="..."></script>
2
<script>
3
Weglot.initialize({
4
// ...
5
extra_merged_selectors: ["code", ".merge-me-please"]
6
})
7
</script>
8
9
<!-- ... -->
10
11
<p>Use test of <code>extra_merge_selectors</code> option.</p>
12
<!-- Test use of <code wg-1>extra_merge_selectors</code> option. -->
Copied!
With HTML attribute
Add a data-wg-merge attribute to elements you want to merge.
1
<p>Use test of <code data-wg-merge>extra_merge_selectors</code> option.</p>
2
<!-- Test use of <code wg-1>extra_merge_selectors</code> option. -->
Copied!
Last modified 1yr ago