Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Convert specific words of Qt after translate back to native language at runtime
Forum Updated to NodeBB v4.3 + New Features

Convert specific words of Qt after translate back to native language at runtime

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 501 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.
  • thamT Offline
    thamT Offline
    tham
    wrote on last edited by
    #1

    Parts of the words like "bird", "animal", "cat" are translated to another language(assumed it as chinese) at runtime, but when I am doing some condition check, I need them to remain as English. Is there a way to translate chinese back to English(ask Qt do not translate it) when doing condition check?

    std::vector<QString> const target{tr("bird"), tr("cat")};
    //do somehting
    
    //need to keep target[obj_type::bird] return "bird" but not "鳥" only when I do the comparison
    if(key == target[obj_type::bird]){ 
        //do something
    }
    

    thanks

    jsulmJ 1 Reply Last reply
    0
    • thamT tham

      Parts of the words like "bird", "animal", "cat" are translated to another language(assumed it as chinese) at runtime, but when I am doing some condition check, I need them to remain as English. Is there a way to translate chinese back to English(ask Qt do not translate it) when doing condition check?

      std::vector<QString> const target{tr("bird"), tr("cat")};
      //do somehting
      
      //need to keep target[obj_type::bird] return "bird" but not "鳥" only when I do the comparison
      if(key == target[obj_type::bird]){ 
          //do something
      }
      

      thanks

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @tham You should not use strings in this case. Enum would be better.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      thamT 1 Reply Last reply
      2
      • jsulmJ jsulm

        @tham You should not use strings in this case. Enum would be better.

        thamT Offline
        thamT Offline
        tham
        wrote on last edited by tham
        #3

        @jsulm Sadly, need more codes in this case. Thanks

        1 Reply Last reply
        0

        • Login

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