On 11/10/2022 11:19, EXT Panajotis Daras via Development wrote:

I wanted to ask whether the current behavior in the translation module is correct. In short, the question is about the line feed character in the translation file:

    // hellotr_la.ts file
    <?xml version="1.0"  encoding="utf-8"?>
    <!DOCTYPE TS>
    <TS version="2.1"  language="lv_LV">
    <context>
         <name>QPushButton</name>
         <message>
             <source>Hello</source>
             <translation>Hello*\n*world!</translation>
         </message>
    </context>
    </TS>

The customer expects that the translated text will be formatted with respect to the line feed character.
That is incorrect.

You have "\n" in your .ts file, and that has no special meaning in XML. It literally means backslash followed by 'n'. Therefore, when you load the translation, you get precisely that sequence (backslash+n).

If you have a real newline in the TS file (or an equivalent sequence, e.g. &#10;) then you'll get a newline when loading the translation.

This works out of the box when using Linguist, just insert a newline in the translation field by pressing enter.

My 2 c,

--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to