[Development] QTranslator - line feed character

EXT Panajotis Daras daras.panajotis at qt.io
Tue Oct 11 11:19:06 CEST 2022


Hello everyone,

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\nworld!</translation>
    </message>
</context>
</TS>

The customer expects that the translated text will be formatted with respect to the line feed character. However, the translation is displayed as it is written (please see attached image). This behavior comes from the QTranslator<https://doc.qt.io/qt-6.2/qtranslator.html> class, which returns "Hello\\nworld!". Is it a correct behavior? Is there any simple way to change the behavior?

Best regards,
Panajotis Daras
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20221011/e503b108/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: translator_1.png
Type: image/png
Size: 45453 bytes
Desc: translator_1.png
URL: <http://lists.qt-project.org/pipermail/development/attachments/20221011/e503b108/attachment-0001.png>


More information about the Development mailing list