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. Translating Into Russian on a milti-window platform

Translating Into Russian on a milti-window platform

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 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.
  • A Offline
    A Offline
    asweetroxxi
    wrote on last edited by
    #1

    Hello,

    Im An entry level programmer and new to QT too. I have a project where i am hard coding my programing into a three diffrent languages. I am having an issue on figuring out how to hard code Russian instead of letters i get ?????.
    

    my code is broken down into FR.h
    SP.h
    German.h
    Russian.h ->i understand the others use a latin codec but russian doesnt
    english.h example bellow of how files look-each word is defined
    @#ifndef EN_H
    #define EN_H

    #define TR_PRG_EN "Program"
    #define TR_HELP_EN "Help"
    #define TR_PASSRW_EN "Pass: R/W"
    #define TR_ALLOWWRITE_EN "Allow Write"
    #define TR_SERIAL_EN "Serial #"
    #define TR_ALLOWREAD_EN "Allow Read"
    #define TR_PRO_EN "Product #"
    #define TR_MEMSIZE_EN "Mem. Size"
    #define TR_TRIP_EN "Trip #"
    #define TR_RANGE_EN "Range"
    #define TR_DESCR_EN "Description"
    #define TR_LOGSET_EN "Logger Settings"
    #define TR_INTTEMP_EN "Int. Temp (NTC)"
    #define TR_HHIGH_EN "HHigh(°F)"
    #define TR_HIGH_EN "High(°F)"
    #define TR_LOW_EN "Low(°F)"
    #define TR_LLOW_EN "LLow(°F)"@

    with russian.h
    @#ifndef RU_H
    #define RU_H

    #define TR_ENCODING "utf-8"
    #define TR_PRG_RU "??????????"
    #define TR_HELP_RU "Help"
    #define TR_PASSRW_RU "?????????"
    #define TR_ALLOWWRITE_RU "????????"
    #define TR_SERIAL_RU "???????? #"
    #define TR_ALLOWREAD_RU "????????? ??????"
    #define TR_PRO_RU "??????? #"
    #define TR_MEMSIZE_RU "?????? ?????? "
    #define TR_TRIP_RU "??????? #"
    #define TR_RANGE_RU "????????"
    #define TR_DESCR_RU "????????"@

    i then have Clang.cpp(class,with.h file) file which i put the words into a Qlist<qlist<qstringlist>>(2d array)->below is an example

    @const char *trMemory[NB_LAN]={TR_MEMORY_EN,TR_MEMORY_FR,TR_MEMORY_SP,TR_MEMORY_IT,TR_MEMORY_RU,TR_MEMORY_GR,TR_MEMORY_PR};
    const char *trOK[NB_LAN]={TR_OK_EN,TR_OK_FR,TR_OK_SP,TR_OK_IT,TR_OK_RU,TR_OK_GR,TR_OK_PR};
    const char *trName[NB_LAN]={TR_NAME_EN,TR_NAME_FR,TR_NAME_SP,TR_NAME_IT,TR_NAME_RU,TR_NAME_GR,TR_NAME_PR};
    const char *trDesc[NB_LAN]={TR_DESC_EN,TR_DESC_FR,TR_DESC_SP,TR_DESC_IT,TR_DESC_RU,TR_DESC_GR,TR_DESC_PR};
    const char *trLL[NB_LAN]={TR_LL_EN,TR_LL_FR,TR_LL_SP,TR_LL_IT,TR_LL_RU,TR_LL_GR,TR_LL_PR};
    const char *trL[NB_LAN]={TR_L_EN,TR_L_FR,TR_L_SP,TR_L_IT,TR_L_RU,TR_L_GR,TR_L_PR};
    const char *trH[NB_LAN]={TR_H_EN,TR_H_FR,TR_H_SP,TR_H_IT,TR_H_RU,TR_H_GR,TR_H_PR};
    const char *trHH[NB_LAN]={TR_HH_EN,TR_HH_FR,TR_HH_SP,TR_HH_IT,TR_HH_RU,TR_HH_GR,TR_HH_PR};
    CLang::CLang()
    {
    for(int i=0;i<NB_LAN;i++)
    {

        strTab << QStringList();
        strTab[i] << trPrg[i];            //m_tabLogger
        strTab[i] << trHelp[i];           //m_textBrowserHelp
        strTab[i] << trPassrw[i];         //label_13
        strTab[i] << trAllowWrite[i];     //m_checkBoxLoggerAllowWrite
        strTab[i] << trSerial[i];         //label_2
        strTab[i] << trAllowRead[i];      //m_checkBoxLoggerAllowRead
        strTab[i] << trPro[i];            //label_3
        strTab[i] << trMemSize[i];        //label_5
        strTab[i] << trTrip[i];           //label_6@
    

    then i call it in the main window , so my question how do i make the russian language show the letters
    another question i have is i mulitple windows how do i call these translations on those different windows

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on last edited by
      #2

      Please check out how to do internationalization properly: http://qt-project.org/doc/qt-4.8/internationalization.html
      The way you do it is just... well... suboptimal.

      PS: The reason why you get strange characters is that your code file is probably in a different encoding (UTF-8, ISO-xxxx,...) than what the according display functions expect. But don't fix that, throw away your internationalization code and do it like described in the article above. It will be much easier for you and your translators (if that's also you, then it will be easier for you quadratically!)

      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