.ODT Function {__ (XXX) __} does not work

In the template .odt I tried to add a translation (for the propal module)
In lang, I added a translation in propal.lang
In the propal template I entered {__ (translation key) __}
What am I doing wrong ?

DOLIBARR ENVIRONMENT
- Version: [7.0.0]
- Operating System: [Linux CentOS 7]
- Web Server: [Apache 2.4.6]
- PHP: [7.0.26]
- Database: [MySQL 5.7.22]

Hello

Thanks for posting. You have posted your issue in the How to / Help section.

Kindly post (here) your Dolibarr setup environment as suggested in [url]www.dolibarr.org/t/post-guidelines/16873/1 This will greatly help the community in assisting you where possible.

Hello,
Did you try with a other translation key in standard lang file?

langs/en_GB/propal.lang here, ta adds a new translation. in the template, enter {__ (XXX) __} instead of xxx - enter the translation key.
In pdf, this option of changing translations by language works. I only have a problem with odt.

Anyone can help me?

Hi,

Please copie past all the thing you have done and we will may be able to help

1 Like

EDIT:
langs/en_US/propal.lang - add test=test translation

documents/doctemplates/proposals/template.ods - add {(test)}

Generating a document. The translation should be displayed(test translation), and is displayed {(test)}

Where do I make mistakes?

I have described my problem well? Can anyone help me?

I want to set up a 2 language skill in the .ods template.
If you choose, for example, Polish, the text will be displayed in Polish.
And if I choose English, the text in English will be displayed.
Type of text: Buyer, description, etc.
In create on ODT - I read that you have to write
{__ (XXX) } = Translated value of a translation key. XXX - Note: Translation must be loaded with $ langs-> load (“languagefile”)
{
[XXX] __} = Value of constant XXX

doc_generic_proposal_odt.modules - this is in this file $langs->load(“main”);

langs/en_US/propal.lang - add test=test translation
documents/doctemplates/proposals/template.ods - add {(test)}

The language does not work when the document is generated.
Only the default language works

Pièces jointes :

Hello,

If you modify propal.lang, you should include $langs->load(“propal”);

I’ve included in the doc_generic_proposal_odt.modules file
$ langs-> load (“propal”);

And further in the generated template it does not display my translation.

In Attachment: pictures what I change

Pièces jointes :

help ?

Hi
Unfortunately I encounter the same problem. In the odt file, {line_product_label} is not translated and stays in the original language while {line_desc} is perfectly translated. Can anyone help with this matter? Or do I misunderstand the ODT function described in this thread?
Thanks a lot for your help.

It took half a year. And no one in this forum wants to help you solve the problem. I’m refreshing the post.

Hi Paji, did you get a response on the topic? Can you post your ODT file as to not make the same mistakes or try to find the solution

Hello,

Here is the solution:

If you have some problems to translate {__(XXX)__} into your ODT template, it is necessary to verify the format of the string because your ODT file can contain some tags to define the style of text.

If you unzip the ODT file, you can see in the content.xml that the string can be exploded like this: {__(</text:span><text:span text:style-name=“T14”>gme_name</text:span><text:span text:style-name=“T7”>)__}

Then, it will be not possible to translate correctly the string as the dictionnary contains a key like __(gme_name)__.

So, it is important when you type your key into the ODT file to copy/paste without any style (the simple option is to paste the key into notepad and then copy/paste into the ODT file to be sure that all styles are removed)

Hi,

With LibreOffice you can also use the Ctrl+M to remove direct formatting from Tags : ODT templates creation docu

1 Like