Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Multilingual preparation - How to make Chinese Text or japanese text appear on menu items or button captions etc.,

Multilingual preparation - How to make Chinese Text or japanese text appear on menu items or button captions etc.,

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
20 Posts 5 Posters 0 Views 1 Watching
  • 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.
  • G ganesa moorthy

    Hi, At present i was assigned a work of preparing an application that to support multilingual interface. It is expected to support many languages esp, chinese, japanese etc. It would be helpful anyone guide me... Thanks in advance, Ganesh

    Thanks a lot

    M Offline
    M Offline
    Matthew Faithfull
    wrote on last edited by
    #3

    What OS versions are you targetting? WinCE (3.x, 4.x, 5.x, 6.x), Win9X, Win NT/2000/XP/Vista, Server 2K, Server 2003, Server 2008. This will probably the biggest determining factor in how you go about this job. What features do you want in multi-languages, fixed text display, variable text display generated from numeric values or network messages, variable text display generated from user input in a single fixed language, variable text display generated from user input directly in variable languages requiring IME (Input Method Editor) support. You want Chinese and Japanese support and presumably English but do you want Arabic or Hebrew RTL (Right To Left) laguage support. Do you need to support SIPs (Software Input Panels) or merely different keyboard layouts? Each of these levels of requirements will likely change the way you need to do things, which technologies you need to incorporate and how hard the task is. Are you starting the project from scratch of upgrading an existing single language code base? Do you use any 3rd party components, especially in the UI and can they support the languages you want? Last but not least get some good books on Internationalization (I18n) and add www.unicode.org to you browser favourites. Good Luck. :) P.S. if this is a substantial application running on multiple Os version then clear a year in your schedule.

    Nothing is exactly what it seems but everything with seems can be unpicked.

    G 1 Reply Last reply
    0
    • R Rajesh R Subramanian

      Is your application Unicode aware at first? Don't ask me what Unicode is.

      Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

      G Offline
      G Offline
      ganesa moorthy
      wrote on last edited by
      #4

      I have some idea about unicode...can you give me any samples or links that help me to know better. Thanks in advance.

      Thanks a lot

      R 1 Reply Last reply
      0
      • R Rajesh R Subramanian

        Is your application Unicode aware at first? Don't ask me what Unicode is.

        Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

        G Offline
        G Offline
        ganesa moorthy
        wrote on last edited by
        #5

        I have some idea about unicode...can you give me any samples or links that help me to know better. Thanks in advance.

        Thanks a lot

        1 Reply Last reply
        0
        • M Matthew Faithfull

          What OS versions are you targetting? WinCE (3.x, 4.x, 5.x, 6.x), Win9X, Win NT/2000/XP/Vista, Server 2K, Server 2003, Server 2008. This will probably the biggest determining factor in how you go about this job. What features do you want in multi-languages, fixed text display, variable text display generated from numeric values or network messages, variable text display generated from user input in a single fixed language, variable text display generated from user input directly in variable languages requiring IME (Input Method Editor) support. You want Chinese and Japanese support and presumably English but do you want Arabic or Hebrew RTL (Right To Left) laguage support. Do you need to support SIPs (Software Input Panels) or merely different keyboard layouts? Each of these levels of requirements will likely change the way you need to do things, which technologies you need to incorporate and how hard the task is. Are you starting the project from scratch of upgrading an existing single language code base? Do you use any 3rd party components, especially in the UI and can they support the languages you want? Last but not least get some good books on Internationalization (I18n) and add www.unicode.org to you browser favourites. Good Luck. :) P.S. if this is a substantial application running on multiple Os version then clear a year in your schedule.

          Nothing is exactly what it seems but everything with seems can be unpicked.

          G Offline
          G Offline
          ganesa moorthy
          wrote on last edited by
          #6

          Target OS: Win XP, It is expected to deal with variable text display, and to support arabic also, i need SIP. Already i am in the middle of the project and i need to add these features, perhaps i may be needed to create controls from scratch. Please help me how to proceed. Thanks

          Thanks a lot

          R M 2 Replies Last reply
          0
          • G ganesa moorthy

            I have some idea about unicode...can you give me any samples or links that help me to know better. Thanks in advance.

            Thanks a lot

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #7

            You still haven't answered my question. Is your application Unicode aware?

            Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

            G N 2 Replies Last reply
            0
            • R Rajesh R Subramanian

              You still haven't answered my question. Is your application Unicode aware?

              Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

              G Offline
              G Offline
              ganesa moorthy
              wrote on last edited by
              #8

              Hi Thanks for ur response! No, in Project settings C/C++ Tab-> Project options -> it was set "_MBCS" , therefore i guess it is not aware of unicode. Please guide me! Thanks a lot

              Thanks a lot

              R 1 Reply Last reply
              0
              • R Rajesh R Subramanian

                You still haven't answered my question. Is your application Unicode aware?

                Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                N Offline
                N Offline
                NormDroid
                wrote on last edited by
                #9

                This statement doesn't give you too much hope "I have some idea about unicode..." holy cow, it's time to leave the room.

                www.software-kinetics.co.uk

                R 1 Reply Last reply
                0
                • G ganesa moorthy

                  Hi Thanks for ur response! No, in Project settings C/C++ Tab-> Project options -> it was set "_MBCS" , therefore i guess it is not aware of unicode. Please guide me! Thanks a lot

                  Thanks a lot

                  R Offline
                  R Offline
                  Rajesh R Subramanian
                  wrote on last edited by
                  #10

                  So, you guessed it right. Replace _MBCS with _UNICODE. Do that, and try compiling. You'll hit a dead end and then start reading on Generic text mappings. But, fortunately for you, if the project already is following Generic text mappings, then you could easily proceed by installing the language scripts that you plan to use, and then get on with your project. I say, you have a long way to go. But go step by step and it isn't very difficult.

                  Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                  1 Reply Last reply
                  0
                  • N NormDroid

                    This statement doesn't give you too much hope "I have some idea about unicode..." holy cow, it's time to leave the room.

                    www.software-kinetics.co.uk

                    R Offline
                    R Offline
                    Rajesh R Subramanian
                    wrote on last edited by
                    #11

                    :laugh: But usually I give them a try. Some people just pick it up right off. And if they don't, I do leave the room. :)

                    Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                    1 Reply Last reply
                    0
                    • G ganesa moorthy

                      Target OS: Win XP, It is expected to deal with variable text display, and to support arabic also, i need SIP. Already i am in the middle of the project and i need to add these features, perhaps i may be needed to create controls from scratch. Please help me how to proceed. Thanks

                      Thanks a lot

                      R Offline
                      R Offline
                      Royaltvk
                      wrote on last edited by
                      #12

                      NO U Need not Create all the interfaces once again. U Just need to Give id to all the Controls and load them using Resource Dll. inline HINSTANCE LoadResourceDll() { HKEY hkey; unsigned long no = 2048; DWORD pos; BYTE strRegValue[2048] = "\0"; CString csLanguage = _T(""); CString csDllPath; wchar_t *pwcDllPath = NULL; HINSTANCE m_hResInstance = NULL; //get the current language information from the registry if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,_T("Path to ur registered application"),0,_T("Registration"),REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hkey,&pos) == ERROR_SUCCESS) { if( RegQueryValueEx(hkey,_T("CurrentLanguage"),NULL,NULL,strRegValue,&no) == ERROR_SUCCESS) { csLanguage = (wchar_t*)strRegValue ; csLanguage.TrimLeft(); csLanguage.TrimRight(); } } TCHAR lpBuffer[1028]; //get the system directory as the resource dlls will be there GetSystemDirectory(lpBuffer,1028); csDllPath = (LPCTSTR) (const char*) lpBuffer; csDllPath.TrimLeft(); csDllPath.TrimRight(); //append the language dll based on the current lang info in registry along with system directory if (Encrypt(_T("ENG")) == csLanguage) csDllPath+= "\\DUresENG.dll"; else if (Encrypt(_T("JPN")) == csLanguage) csDllPath+= "\\DUresJPN.dll"; else csDllPath+= "\\DUresENG.dll"; // Load resource DLL m_hResInstance = LoadLibrary(csDllPath); return m_hResInstance; } And In ur .Cpp Call Controls like this, Call all controls in one Function. call them in OnInitDialog of Ur Dialog Class. void CAttributeProperties::SetDialogLabels() { m_csLabel = LoadResourceString(m_hResInstance ,AfxGetApp()->m_hInstance,1); GetDlgItem(IDOK)->SetWindowText(m_csLabel); } And call them in OnInitDialog of Ur Dialog Class. BOOL CAttributeProperties::OnInitDialog() { CDialog::OnInitDialog(); SetDialogLabels(); }

                      1 Reply Last reply
                      0
                      • G ganesa moorthy

                        Target OS: Win XP, It is expected to deal with variable text display, and to support arabic also, i need SIP. Already i am in the middle of the project and i need to add these features, perhaps i may be needed to create controls from scratch. Please help me how to proceed. Thanks

                        Thanks a lot

                        M Offline
                        M Offline
                        Matthew Faithfull
                        wrote on last edited by
                        #13

                        OK XP is a good start that makes it a lot easier than it might be. You need to research UNICODE of course, the link I gave you is a start. SIPS are not hard to write but there aren't many samples about, look for some Open Source ones. You may have to trawl incomprehensible Chinese and Japanese web sites and guess at the link for downloading to get what you need. Two other technologies you should look into IMEs, you'll need to get and use 3 of these, for Chinese, Japanese and Korean for development and you may or may not choose to ship them. I think there are some fairly standard ones with XP and some more popular after market replacements, quiz your far east sales people to find out what your potential customers are used to. Install these, switch on support of the language in control panel and hey presto your standard Edit control becomes IME aware and capable of entering complex characters like Japanese Katakana ?? ( way cool you have to try it :-D ) The other tech to look at is TSF (Text Services Framework) it's huge and I've never used it (not available on CE) but it might take a lot of work out of what you need to do. Look also at multilanguage resources for string tables, I'm sure there's something on CP about doing that effectively. When it comes to rendering text, even RTL, XP will do that for you reasonably well, DrawTextEx backend onto a whole DLL full of UNICODE goodies, BIDI (Bidirectional text) algorithum, Script Shaping for Arabic and of course all the glyph mapping stuff. Be glad you don't have to roll your own as some of this stuff is seriously hard :) . Two rules to always keep in mind. 1. Never use any hard coded text in your code that might end up anywhere near the UI. Keep it all in resources or better still in external files e.g. XML 2. Keep a definitive list of the client system requirements for using your software, e.g. 'must have Japanese language pack installed', 'must have working Korean IME' otherwise it's likely to end up working on your dev PC but nowhere else. :)

                        Nothing is exactly what it seems but everything with seems can be unpicked.

                        G 1 Reply Last reply
                        0
                        • M Matthew Faithfull

                          OK XP is a good start that makes it a lot easier than it might be. You need to research UNICODE of course, the link I gave you is a start. SIPS are not hard to write but there aren't many samples about, look for some Open Source ones. You may have to trawl incomprehensible Chinese and Japanese web sites and guess at the link for downloading to get what you need. Two other technologies you should look into IMEs, you'll need to get and use 3 of these, for Chinese, Japanese and Korean for development and you may or may not choose to ship them. I think there are some fairly standard ones with XP and some more popular after market replacements, quiz your far east sales people to find out what your potential customers are used to. Install these, switch on support of the language in control panel and hey presto your standard Edit control becomes IME aware and capable of entering complex characters like Japanese Katakana ?? ( way cool you have to try it :-D ) The other tech to look at is TSF (Text Services Framework) it's huge and I've never used it (not available on CE) but it might take a lot of work out of what you need to do. Look also at multilanguage resources for string tables, I'm sure there's something on CP about doing that effectively. When it comes to rendering text, even RTL, XP will do that for you reasonably well, DrawTextEx backend onto a whole DLL full of UNICODE goodies, BIDI (Bidirectional text) algorithum, Script Shaping for Arabic and of course all the glyph mapping stuff. Be glad you don't have to roll your own as some of this stuff is seriously hard :) . Two rules to always keep in mind. 1. Never use any hard coded text in your code that might end up anywhere near the UI. Keep it all in resources or better still in external files e.g. XML 2. Keep a definitive list of the client system requirements for using your software, e.g. 'must have Japanese language pack installed', 'must have working Korean IME' otherwise it's likely to end up working on your dev PC but nowhere else. :)

                          Nothing is exactly what it seems but everything with seems can be unpicked.

                          G Offline
                          G Offline
                          ganesa moorthy
                          wrote on last edited by
                          #14

                          Thanks a lot. Before getting into deep i want to create a simple application that displays a chinese text in a Static control? How can i achieve that ? Sorry if i am troubling you. Thanks a lot again!

                          Thanks a lot

                          M 1 Reply Last reply
                          0
                          • G ganesa moorthy

                            Thanks a lot. Before getting into deep i want to create a simple application that displays a chinese text in a Static control? How can i achieve that ? Sorry if i am troubling you. Thanks a lot again!

                            Thanks a lot

                            M Offline
                            M Offline
                            Matthew Faithfull
                            wrote on last edited by
                            #15

                            That's a good place to start. You need a few things. WinXP Chinese Language pack installed. It's probably still an optional Windows Update on the Windows Update site. Make sure your application has the UNICODE and _UNICODE (someone at MS screwed up) preprocessor symbols defined in the project. The Static control must be using a font with Chinese characters, e.g. Arial UNICODE Copy some Chinese characters from a Web page and paste them into your Chinese language string table resource. The BBC news site news.bbc.co.uk is good 'cause they have multiple translations of the main pages you can access. Make sure your code uses tcs or wcs versions of all the string handling functions, TCHAR or wchar_t everywhere and never char so you don't corrupt the UNICODE characters between loading them from your resource and calling SetWindowText on your Static control. That it. ?? :)

                            Nothing is exactly what it seems but everything with seems can be unpicked.

                            G 1 Reply Last reply
                            0
                            • M Matthew Faithfull

                              That's a good place to start. You need a few things. WinXP Chinese Language pack installed. It's probably still an optional Windows Update on the Windows Update site. Make sure your application has the UNICODE and _UNICODE (someone at MS screwed up) preprocessor symbols defined in the project. The Static control must be using a font with Chinese characters, e.g. Arial UNICODE Copy some Chinese characters from a Web page and paste them into your Chinese language string table resource. The BBC news site news.bbc.co.uk is good 'cause they have multiple translations of the main pages you can access. Make sure your code uses tcs or wcs versions of all the string handling functions, TCHAR or wchar_t everywhere and never char so you don't corrupt the UNICODE characters between loading them from your resource and calling SetWindowText on your Static control. That it. ?? :)

                              Nothing is exactly what it seems but everything with seems can be unpicked.

                              G Offline
                              G Offline
                              ganesa moorthy
                              wrote on last edited by
                              #16

                              I tried to copy the chinese string into the string table but it is simply being printed as ???,??. I changed the language of the string table. What could be the steps i need to follow to achieve that ? And also here are the snippets i have done, just look at this and guide me if i am wrong. TCHAR * p = _T("MLST ????"); CStatic * pStatic = new CStatic; CRect rcDefault(10,10,10,20); pStatic->Create(_T(""),WS_TABSTOP|WS_CHILD|WS_VISIBLE,rcDefault,this,3000); pStatic->ModifyStyleEx (0,WS_EX_CLIENTEDGE); pStatic->ModifyStyle(0,WS_GROUP); pStatic->MoveWindow (0,0,100,30); pStatic->Invalidate (); pStatic->UpdateWindow(); CFont* pFont; pFont = new CFont(); pFont->CreateFont( 20,0,0,0,FW_NORMAL,TRUE,FALSE,0,DEFAULT_CHARSET ,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS, _T("Arial Unicode MS")); pStatic->SetFont(pFont); pStatic->SetWindowText(p); Thanks a lot

                              Thanks a lot

                              modified on Saturday, March 29, 2008 8:44 AM

                              M 1 Reply Last reply
                              0
                              • G ganesa moorthy

                                I tried to copy the chinese string into the string table but it is simply being printed as ???,??. I changed the language of the string table. What could be the steps i need to follow to achieve that ? And also here are the snippets i have done, just look at this and guide me if i am wrong. TCHAR * p = _T("MLST ????"); CStatic * pStatic = new CStatic; CRect rcDefault(10,10,10,20); pStatic->Create(_T(""),WS_TABSTOP|WS_CHILD|WS_VISIBLE,rcDefault,this,3000); pStatic->ModifyStyleEx (0,WS_EX_CLIENTEDGE); pStatic->ModifyStyle(0,WS_GROUP); pStatic->MoveWindow (0,0,100,30); pStatic->Invalidate (); pStatic->UpdateWindow(); CFont* pFont; pFont = new CFont(); pFont->CreateFont( 20,0,0,0,FW_NORMAL,TRUE,FALSE,0,DEFAULT_CHARSET ,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS, _T("Arial Unicode MS")); pStatic->SetFont(pFont); pStatic->SetWindowText(p); Thanks a lot

                                Thanks a lot

                                modified on Saturday, March 29, 2008 8:44 AM

                                M Offline
                                M Offline
                                Matthew Faithfull
                                wrote on last edited by
                                #17

                                If text is appearing as question marks or boxes then the program displaying it isn't coping too well with UNICODE itself, either the font it's using or it isn't fully UNICODE enabled. The Character Map Accessory program that comes with Windows is very useful for looking at what is and is not in a given font and getting the correct U+ values for the letters you want. Try getting a single character from there if C&P from IE is not working. You have made sure you've got all the relevant language packs installed haven't you? Your code looks OK. I would probably have done it the easy way with a Dialog template but that's just because I'm lazy. For more on multilanguage Resource files you'll need to search Code Project, it's too long since I did any of that to give you advice, we use external XML files to lookup translations and resource files are all in English holding the source strings for looking up in the XML. Whatever you do don't despair, 2 years ago I was doing exactly what you're doing trying to get just any Chinese output anyhow on a Dialog under XP. Now I have a large WinCE project in 17 languages with multi-IME text entry (Microsoft say you can't do this on CE :laugh: ). Good Luck :)

                                Nothing is exactly what it seems but everything with seems can be unpicked.

                                G 1 Reply Last reply
                                0
                                • M Matthew Faithfull

                                  If text is appearing as question marks or boxes then the program displaying it isn't coping too well with UNICODE itself, either the font it's using or it isn't fully UNICODE enabled. The Character Map Accessory program that comes with Windows is very useful for looking at what is and is not in a given font and getting the correct U+ values for the letters you want. Try getting a single character from there if C&P from IE is not working. You have made sure you've got all the relevant language packs installed haven't you? Your code looks OK. I would probably have done it the easy way with a Dialog template but that's just because I'm lazy. For more on multilanguage Resource files you'll need to search Code Project, it's too long since I did any of that to give you advice, we use external XML files to lookup translations and resource files are all in English holding the source strings for looking up in the XML. Whatever you do don't despair, 2 years ago I was doing exactly what you're doing trying to get just any Chinese output anyhow on a Dialog under XP. Now I have a large WinCE project in 17 languages with multi-IME text entry (Microsoft say you can't do this on CE :laugh: ). Good Luck :)

                                  Nothing is exactly what it seems but everything with seems can be unpicked.

                                  G Offline
                                  G Offline
                                  ganesa moorthy
                                  wrote on last edited by
                                  #18

                                  Thank you very much for your valuable response! i will do as per your directions.!

                                  Thanks a lot

                                  R 1 Reply Last reply
                                  0
                                  • G ganesa moorthy

                                    Thank you very much for your valuable response! i will do as per your directions.!

                                    Thanks a lot

                                    R Offline
                                    R Offline
                                    Royaltvk
                                    wrote on last edited by
                                    #19

                                    Did u able to paste Chinese string in Static control ?

                                    G 1 Reply Last reply
                                    0
                                    • R Royaltvk

                                      Did u able to paste Chinese string in Static control ?

                                      G Offline
                                      G Offline
                                      ganesa moorthy
                                      wrote on last edited by
                                      #20

                                      No, i tried but i couldn't. But i reached the goal in different way that, storing strings in a separate file and reading them from Unicode aware project and printing (SetWindowText) in a control. It works and it is fine. If you know how to paste the chinese text then please let me know~!

                                      Thanks in advance

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • World
                                      • Users
                                      • Groups