Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Localization strings with Unicode characters
Forum Updated to NodeBB v4.3 + New Features

Localization strings with Unicode characters

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmllocalizationunicode
2 Posts 1 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    popov895
    wrote on 6 Jan 2016, 22:28 last edited by
    #1

    Hi there.

    I'm using Qt 4.8 and I need to localize some string in the qml file, which contains Unicode characters. Example:

    Label {
        text: qsTr("°C")
    }
    

    But after the localization, my app continue to display °C instead of درجة مئوية. What am I doing wrong?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      popov895
      wrote on 6 Jan 2016, 23:35 last edited by
      #2

      Solution:

      • inside main.cpp after creating the application object add the following line:
      QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
      
      • inside .pro file add the following line:
      CODECFORTR = UTF-8
      
      1 Reply Last reply
      0

      2/2

      6 Jan 2016, 23:35

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved