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.
Nothing to merge:
<p>This is an example</p>
<!-- This is an example -->
No merge:
<p>This is <b>an example</b></p>
<!-- This is -->
<!-- an example -->
Merging:
<p>This is <b>an example</b></p>
<!-- This is <b wg-1>an example</b> -->
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
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:
<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.<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. -->
Last modified 3yr ago