Hello,
Thank you for getting in touch with us!
This is actually the way TranslatePress is intended to work – by translating everything string by string instead of page by page. Our plugin does not create separate pages for the translated versions of your posts / pages – each translated string is saved into the database and displayed dynamically when requested.
This approach makes the plugin more lightweight, as only one occurance of the string needs to be translated instead of all of them – however, it causes drawbacks as the one mentioned above.
You can provide two separate translations for the same word by wrapping a <span class=”translation-block”></span> around the text that you want to be different.
You can read more about it here: https://translatepress.com/docs/translation-editor/#translation-blocks
If you wrap it around a simple text, you won’t see any difference. The makes sure that the text you will translate also includes HTML elements, so a way to get this to work is to do something like this:
<span class=”translation-block”><span data-context=”text1″>Brllnt</span></span>
The first span will make sure to consider the entire text as <span data-context=”text1″>Brllnt</span> so this way it will be different from the simple Brllnt string.
The data-context=”text1″ is used as a way to make sure that this will be different from a simple <span>Brllnt</span> element.
This is used only if you want more different version for the same text.
Also, keep in mind that if you insert two <span data-context=”text1″>Brllnt</span> elements, those will be translated the same.
Best regards,
Hello Dragos.
Thank you for your reply, it was very clear.
Unfortunately it does not solve my problem at the moment. I understand the solution, I understand html tags. But in my case, when using a Builder (Divi) some elements have limited HTML editing (in this particular case, the “title” of a button, does not allow me to add html tags).
Although I can solve this by creating the module with simple html, it would be ideal to achieve it in another way.
It’s good to know that TranslatePress is aware of this, and are looking for a solution.
Thanks
Just a curious bystander here, I haven’t experimented with this. However, it sounds like you can add the translation-block class to any tag. So, if your builder lets you add a class to an enclosing div element then you could have the entire button element considered as a single translatable block by TranslatePress.
I could see this being useful for other reasons as well, such as if you want the button to appear differently or several buttons to appear in a different order depending on the language.
I do not use Divi, but in the standard block editor I use the Group block sometimes only so I can add a custom class into the code. This is a case when the same technique would be useful.