Discussion:
MFC(VC6) Application Localization from French to Chinese(RPC)
(too old to reply)
kewei
2008-05-21 09:03:15 UTC
Permalink
I am now working for a company, my main job is to complete the
localization of the software into Chinese(RPC).

I am working in the French WindowsXP system. and I changed the Control
Panel -> region and language options -> Advanced Options -> language
for the non Unicode program into Chinese(RPC).

In the beginning, everything works well, for the resource file, I
insert Chinese dialogs, menus, and stringtable. And the Chinese
characters displaying very well.

However, while I build one project(let's say Proj1) and make the
output file as a .lib file(because some other applications need
this .lib file as an input file), somethings wired happened. I build
the Proj1 successfully, but when I tried to run the other applications
that will use this .lib file, the dialog(Chinese) which I have created
in Proj1 displayed with Garbled character(like ??).

So I am very confused about it.
Could someone tell me the reason or probably solutions?

Thanks in advance!
Tom Serface
2008-05-21 15:16:06 UTC
Permalink
Are you using VC6 or 2005/2008? If you are using VC6 you must be sure to
have the Chinese code page loaded for the characters to work correctly.

I would suggest converting the program to Unicode. You are going to save
yourself a lot of trouble in the long run. If you are using 2005 you can
also open the RC file with notepad and resave it as Unicode and the VC
resource editor will maintain it in Unicode for you.

If you have to use non-Unicode you will have to make sure that you only edit
the .RC file when the correct code page is set (I.E. you have region
settings correct).

Tom
Post by kewei
I am now working for a company, my main job is to complete the
localization of the software into Chinese(RPC).
I am working in the French WindowsXP system. and I changed the Control
Panel -> region and language options -> Advanced Options -> language
for the non Unicode program into Chinese(RPC).
In the beginning, everything works well, for the resource file, I
insert Chinese dialogs, menus, and stringtable. And the Chinese
characters displaying very well.
However, while I build one project(let's say Proj1) and make the
output file as a .lib file(because some other applications need
this .lib file as an input file), somethings wired happened. I build
the Proj1 successfully, but when I tried to run the other applications
that will use this .lib file, the dialog(Chinese) which I have created
in Proj1 displayed with Garbled character(like ??).
So I am very confused about it.
Could someone tell me the reason or probably solutions?
Thanks in advance!
kewei
2008-05-25 20:54:23 UTC
Permalink
Post by Tom Serface
Are you using VC6 or 2005/2008? If you are using VC6 you must be sure to
have theChinesecode page loaded for the characters to work correctly.
I would suggest converting the program to Unicode. You are going to save
yourself a lot of trouble in the long run. If you are using 2005 you can
also open the RC file with notepad and resave it as Unicode and the VC
resource editor will maintain it in Unicode for you.
If you have to use non-Unicode you will have to make sure that you only edit
the .RC file when the correct code page is set (I.E. you have region
settings correct).
Tom
Post by kewei
I am now working for a company, my main job is to complete the
localization of the software intoChinese(RPC).
I am working in the French WindowsXP system. and I changed the Control
Panel -> region and language options -> Advanced Options -> language
for the non Unicode program intoChinese(RPC).
In the beginning, everything works well, for the resource file, I
insertChinesedialogs, menus, and stringtable. And theChinese
characters displaying very well.
However, while I build one project(let's say Proj1) and make the
output file as a .lib file(because some other applications need
this .lib file as an input file), somethings wired happened. I build
the Proj1 successfully, but when I tried to run the other applications
that will use this .lib file, the dialog(Chinese) which I have created
in Proj1 displayed with Garbled character(like ??).
So I am very confused about it.
Could someone tell me the reason or probably solutions?
Thanks in advance!
I am using VC6.
and I "have theChinesecode page loaded for the characters to work
correctly." by setting the control panel. I am quite sure I did this
step accurately. I even tried the application in Chinese OS.
Actually, the application i am in charge of in non-unicode, but
the .rc file is saved in unicode I believe.

Actually, as far as I know. of course, a .lib file can't not
contain .rc, but actually, the application add the .rc as an external
dependencies, so the application can use the .rc file and .lib, that's
what my company did and it was working well with other language, like
german, english, french.

The thing that is wired is that, even in the same dialog, some of the
static strings or buttons show in "??" or messy form, but some other
static string or buttons shows successfully in Chinese form.
It's in the same dialog...!
So I couldn't understand why.
Tom Serface
2008-05-28 13:45:59 UTC
Permalink
Yes those kinds of problems are often maddening since they can happen in so
many ways and that's the reason many people are just going to Unicode for
multi-language applications. I didn't think you could do a Unicode .RC file
with VC6, but it could be that the data is getting corrupted even before
your program runs. I remember in VC6 if I were to ever edit any of the
Asian content without first switching to the Asian code page the whole file
would get messed up. There maybe another library function in MFC too that
is reading your data as ANSI. You could trace through in the debugger to
get to the button routine and see what actual string is being assigned.

Tom
Post by kewei
I am using VC6.
and I "have theChinesecode page loaded for the characters to work
correctly." by setting the control panel. I am quite sure I did this
step accurately. I even tried the application in Chinese OS.
Actually, the application i am in charge of in non-unicode, but
the .rc file is saved in unicode I believe.
Actually, as far as I know. of course, a .lib file can't not
contain .rc, but actually, the application add the .rc as an external
dependencies, so the application can use the .rc file and .lib, that's
what my company did and it was working well with other language, like
german, english, french.
The thing that is wired is that, even in the same dialog, some of the
static strings or buttons show in "??" or messy form, but some other
static string or buttons shows successfully in Chinese form.
It's in the same dialog...!
So I couldn't understand why.
kewei
2008-07-01 15:15:25 UTC
Permalink
Post by Tom Serface
Yes those kinds of problems are often maddening since they can happen in so
many ways and that's the reason many people are just going to Unicode for
multi-language applications. I didn't think you could do a Unicode .RC file
with VC6, but it could be that the data is getting corrupted even before
your program runs. I remember in VC6 if I were to ever edit any of the
Asian content without first switching to the Asian code page the whole file
would get messed up. There maybe another library function in MFC too that
is reading your data as ANSI. You could trace through in the debugger to
get to the button routine and see what actual string is being assigned.
Tom
Post by kewei
I am using VC6.
and I "have theChinesecode page loaded for the characters to work
correctly." by setting the control panel. I am quite sure I did this
step accurately. I even tried the application in Chinese OS.
Actually, the application i am in charge of in non-unicode, but
the .rc file is saved in unicode I believe.
Actually, as far as I know. of course, a .lib file can't not
contain .rc, but actually, the application add the .rc as an external
dependencies, so the application can use the .rc file and .lib, that's
what my company did and it was working well with other language, like
german, english, french.
The thing that is wired is that, even in the same dialog, some of the
static strings or buttons show in "??" or messy form, but some other
static string or buttons shows successfully in Chinese form.
It's in the same dialog...!
So I couldn't understand why.
I solved this problem finally.
Actually, the reason is because I am using mutiple .rc files in one
project.
So for the First .rc file, the Chinese character surely displayed
correctly, but for the 2nd, 3rd... .rc files, the vc compile them not
as Chinese codepage(936) but as French codepage(1252).
My solution for this is that, for the project that cannot displayed
chinese correctly, click "view" -> "resource includes", and set the
language as well as the codepage for the next .rc file as following:

#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if defined(AFX_TARG_CHS)
#ifdef _WIN32
LANGUAGE 4, 2
#pragma code_page(936)
#endif //_WIN32
#include "l.chs\afxres.rc" // Standard components
#include "l.chs\afxprint.rc" // printing/print preview
resources
#include "2ndResource.rc"
#include "3rdResource.rc"
#endif

this part of code will be written at the end of .rc file of this
project, consequently, it's also working on the 2ndResource.rc.

but you will find still, the Chinese Character in the 3rdResource.rc
display like "??".
So you could change the "view" -> "resource includes" for the
2ndResource.rc in the same way.

Mihai N.
2008-05-29 06:35:20 UTC
Permalink
Post by kewei
Actually, as far as I know. of course, a .lib file can't not
contain .rc, but actually, the application add the .rc as an external
dependencies, so the application can use the .rc file and .lib, that's
what my company did and it was working well with other language, like
german, english, french.
The thing that is wired is that, even in the same dialog, some of the
static strings or buttons show in "??" or messy form, but some other
static string or buttons shows successfully in Chinese form.
It's in the same dialog...!
What matters:
1. the encoding of the .rc file: should be 936 for Chinese Simplified,
or 950 for Chinese Traditional
2. What you use to edit strings and resize dialogs: with VS6 you
must set the language for non-Unicode applications to the
desired Chinese flavor and reboot
3. What font you use (a Chinese font, or "MS Shell Dlg")
4. How you compile the thing
You need rc.exe switches, or directives *inside* the .rc file
rc.exe /l <localeID> /c <codePage>
localeID = 0x804 for Simplified, 0x404 for Traditional
codePage = see above
inside .rc directives: LANGUAGE and #pragma code_page
One method is enough. If contradictory the internal stuff "wins"
5. Need the support for that language installed
6. Depends what API you use to get the stuff from resources
7. Depends what API you use to show the stuff on screen
8. Depends if the application is Unicode or not.
If it is not, then you *must* set the language for non-Unicode
applications to what you need and reboot

Start by inspecing the resources in the belly of the executable.
If damaged, verify steps 1-5, if ok, verify 6-8

This:
http://www.mihai-nita.net/article.php?artID=20070503a
and this:
http://www.mihai-nita.net/article.php?artID=20060812a
might help you figure out what the problem is.
--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Serge Wautier
2008-05-21 19:48:03 UTC
Permalink
I'm confused: .lib files can't contain resources. Do you mean you built a
DLL?
Where is this dialog stored?

[Warning! ad ahead:]
appTranslator helps you translate your app by removing the hassle of .rc
files maintenance. Create translated copies of your exe/dll or create
resource dlls in one click.

Regards,

Serge.
http://www.apptranslator.com - Localization tool for your MFC applications
Post by kewei
I am now working for a company, my main job is to complete the
localization of the software into Chinese(RPC).
I am working in the French WindowsXP system. and I changed the Control
Panel -> region and language options -> Advanced Options -> language
for the non Unicode program into Chinese(RPC).
In the beginning, everything works well, for the resource file, I
insert Chinese dialogs, menus, and stringtable. And the Chinese
characters displaying very well.
However, while I build one project(let's say Proj1) and make the
output file as a .lib file(because some other applications need
this .lib file as an input file), somethings wired happened. I build
the Proj1 successfully, but when I tried to run the other applications
that will use this .lib file, the dialog(Chinese) which I have created
in Proj1 displayed with Garbled character(like ??).
So I am very confused about it.
Could someone tell me the reason or probably solutions?
Thanks in advance!
kewei
2008-05-25 20:57:53 UTC
Permalink
Post by Serge Wautier
I'm confused: .lib files can't contain resources. Do you mean you built a
DLL?
Where is this dialog stored?
[Warning! ad ahead:]
appTranslator helps you translate your app by removing the hassle of .rc
files maintenance. Create translated copies of your exe/dll or create
resource dlls in one click.
Regards,
Serge.http://www.apptranslator.com- Localization tool for yourMFCapplications
Post by kewei
I am now working for a company, my main job is to complete the
localization of the software intoChinese(RPC).
I am working in the French WindowsXP system. and I changed the Control
Panel -> region and language options -> Advanced Options -> language
for the non Unicode program intoChinese(RPC).
In the beginning, everything works well, for the resource file, I
insertChinesedialogs, menus, and stringtable. And theChinese
characters displaying very well.
However, while I build one project(let's say Proj1) and make the
output file as a .lib file(because some other applications need
this .lib file as an input file), somethings wired happened. I build
the Proj1 successfully, but when I tried to run the other applications
that will use this .lib file, the dialog(Chinese) which I have created
in Proj1 displayed with Garbled character(like ??).
So I am very confused about it.
Could someone tell me the reason or probably solutions?
Thanks in advance!
Hello, actually, for example, App1 project want to use the .lib file
which created by project B.
this dialog stored in the .rc file of projectB. but the .rc file is
added as an external dependencies.
Loading...