Momergil
Momergil

Reputation: 2281

How to write text formatting in translated strings with Qt / Qt Linguist?

Part of my source code displays text in English that uses common text formatting characters (E.g.: \n: "This is my\nstring"). When I call lupdate and open the .ts file in Qt Linguist, it correctly displays the formatted text in the source text preview space (so without the \n or else).

The problem is that, when I translate the string and put the formatting characters in the translation and run the application with the translation file, my app reads the special characters as normal ones!

How may I overcome this problem? How can I put the necessary text formatting so the translation procedure don't generate such kind of bugs?

Upvotes: 0

Views: 512

Answers (1)

Jablonski
Jablonski

Reputation: 18504

When you translate your app, you should press Enter, where you see \n. For example,you see this string in source code This is my\nstring In linguist you should write: This is my[here press Enter] string.

When you run app with this translation, you'll see that all good. I hope, it helps.

Upvotes: 3

Related Questions