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



  • 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


  • Moderators

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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.