Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chinese characters in Dialog labels

Status
Not open for further replies.

Lorey

Programmer
Feb 16, 2003
88
SG
Hi!

I need to modify my non-unicode program in such a way that all labels in the dialogs will be in chinese characters. but the contents (i.e. listbox contents, textbox contents) will be as is (meaning in english). ONLY the labels in the dialog will be in chinese. What are the steps do i need to do to make my program work well.

 
1) Set your Display Properties/Active Title Bar and Inactive Title Bar Font to a font that will take Chinese
2) Edit the .rc file
Where it says

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma codepage (1252)

Change it to

LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#pragma codepage (936)

3) Replace all occurences of

FONT 8, "System"

with

FONT 8, "SimSun"

4) Now all you have to do is translate the text
 
Hi xwb,

In your item 1. Where do I set it? In the my dialog properties->font?

Item 2, I did this.

In item 3, are you still talking about .rc? I have not seen any System fonts used inside.

I still cannot get it work.... please need your additional help.

Will wait for your reply.... :(

 
HI xwb,

For your further info, I can display the chines characters correctly at design time. but when I try to run it, its wrong.... some chars look like chinese but some are not like there's "?" in there. not similar at design time.
 
Hi xwb,

It's ok now. I use SUBLANG_CHINESE_TRADITIONAL instead of SUBLANG_CHINESE_SIMPLIFIED.

Just want to ask another one...

How about the text that is viewed during runtime? how can I show it in chinese... like the text in each tab control which only appears in runtime?
 
Help please with above problem....
 
Sorry - I just assumed most places nowadays used simplified. Traditional is only used in Taiwan. I don't know if 936 is the correct codepage for Traditional. As you've fixed it, I assume whatever you've chosen is correct.

1) How are the tabs set up - is it through the string table or in code?
2) Are all the forms in the same language group. By default, they go to whatever language group your default setting is. Instead of going through all forms with tabs, check the dialogs that are dumped on them. The name on the tab is picked up from the dialog title. It is easier to check this on the .rc file - just check if there are any dialogs or strings in any other group other than Chinese.

If you are setting it at runtime, you have to play with one of the tab control structures. I'll have to check up on this one and get back to you on it - it is a long time since I've had to change tab titles.

 
Setting tab control labels in the OnInitDialog
Code:
// Assume strTitle is a CString containing the title
// pageix is the page index
// m_psp is a property page thing
if (this->m_hWnd)
{
   CTabCtrl* pTab = GetParent()->GetTabControl ();
   TC_ITEM ti;
   ti.mask = TCIF_TEXT
   ti.pszText = (LPTSTR)(LPCTSTR) strTitle;
   pTab->SetItem (pageix, &ti);
}
else
{
   m_psp.pszTitle = (LPCTSTR) strTitle;
   m_psp.dwFlags |= PSP_USETITLE;
}
 
Hi xwb,

I fixed my problem with the tab control. I just use
this in code. The garbage like chars is in chinese. Im using Chinese Taiwan in my language resources. It displayed well in my code and works fine.

m_TabControl.InsertItem(0,_T("¥Î¤á"));
m_TabControl.InsertItem(1,_T("¨®¯¸"));
m_TabControl.InsertItem(2,_T("OCR"));
m_TabControl.InsertItem(3,_T("DCR"));
m_TabControl.InsertItem(4,_T("¨ä¥¦"));

MY NEW PROBLEM now is the list control header label. My trick above didnt worked here. The label is being displayed at runtime. The code is

m_groupList.InsertColumn(0,"ID",LVCFMT_LEFT,90);
m_groupList.InsertColumn(1,"Loc/Train No/Service",LVCFMT_LEFT,250);
m_groupList.InsertColumn(2,"TSI",LVCFMT_LEFT);

I need to change the, like "ID" to chinese equivalent.

Take note that my program is not yet supporting unicode.
Showing chinese in list labels would still be possible just like what happen to button labels?



 
When you say it doesn't work, what happens? Does it come up with garbage or nothing at all?

Have you tried SetFont on the form or on the control? That works sometimes.
 
Hi xwb,

I fixed my problem with the tab control. I just use
this in code. The garbage like chars is in chinese. Im using Chinese Taiwan in my language resources. It displayed well in my code and works fine.

m_TabControl.InsertItem(0,_T("¥Î¤á"));
m_TabControl.InsertItem(1,_T("¨®¯¸"));
m_TabControl.InsertItem(2,_T("OCR"));
m_TabControl.InsertItem(3,_T("DCR"));
m_TabControl.InsertItem(4,_T("¨ä¥¦"));

MY NEW PROBLEM now is the list control header label. My trick above didnt worked here. The label is being displayed at runtime. The code is

m_groupList.InsertColumn(0,"ID",LVCFMT_LEFT,90);
m_groupList.InsertColumn(1,"Loc/Train No/Service",LVCFMT_LEFT,250);
m_groupList.InsertColumn(2,"TSI",LVCFMT_LEFT);

I need to change the, like "ID" to chinese equivalent.

Take note that my program is not yet supporting unicode.
Showing chinese in list labels would still be possible just like what happen to button labels?



 
it displays garbage like characters... I already set the font to SimSun just like in the buttons
 
Is it possible to display chinese characters in list control's header labels even the whole program doesnt support unicode?

I did it in buttons and static text and tab control's labels.

Just cant make it work in list control's header labels

Please help!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top