문제

I have a Borland C++ Builder VCL app (so I am not working with Unicode yet), I want to provide a simple translation of controls' caption text to Russian at runtime.

I can easily use EnumChildWindows to get the English caption, then lookup the translation and replace the caption text using SetWindowText. This does work well for my western European translations where I don't have to worry about the font. But I am not sure how the Russian version of Windows and then VCL handles 8 bit cyrillic character sets.

Currently all the VCL controls have the font settings:

Charset=DEFAULT_CHARSET
name=MS Sans Serif

Am I correct in assuming that when my program is run under a Russian version of Windows the character set will be cyrillic with the DEFAULT_CHARSET setting so I won't need to change the font settings in all my controls?

If I do have to change the font (at run time), should the Windows API function SendMessage(hwnd,WM_SETFONT,(WPARAM)hFont,TRUE) work with VCL controls ? I have tried using the CreateFont() and SendMessage(..WM_SETFONT..) with RUSSIAN_CHARSET and a cyrillic font face. This doesn't appear to have any effect, it keeps the font that was set for the control in the form at design time (even ANSI_CHARSET and a standard Windows-installed font face doesn't affect the controls' font) so I looking for confirmation that I won't have to change the font of the controls, or else tell me some VCL method for setting all the controls' font settings at runtime .

올바른 솔루션이 없습니다

다른 팁

There is no need to reinvent the bicycle. Why don't you use Integration Translation Environment Tools which are provided with Borland C++Builder? There is a wizard that will help you with translations and will make a special resource file which will contain translation of all text strings in your application. Then program, will check system language and availible language resource files at startup, and will automatically use appropriate language. Check C++Builder help system with index - "Integrated Translation Environment (ITE)" for more detailed process description.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top