TRichEdit and charset

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
Munzig
Posts: 4
Joined: Thu Aug 26, 2004 2:09 pm

TRichEdit and charset

Post by Munzig »

I have to localize my applications into Russian and I noticed some problems with CHARSETS.

The Translation Editor doesn't support CharSet's for TComboBox and TRichEdit. It should be included in future.

When I change to Russian, I have to set by myselfe
ComboBox.Font.Charset:= RUSSIAN_CHARSET;
Of course I have to change back, when I choose another languages in the ComboBox.

But Charset is ignored for TRichEdit. Even when I specify Russian, I get strange characters. Can anybody help?

Do I get problems on a Russian OS if I leave all the charset’s on DEFAULT_CHARSET? Which charset is actually the default one and where can I check it on the OS? It seems that it is not displayed under Control Panel's Regional Settings.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

In case any control has ParentFont property set to True it won't be included into Charsets and Fonts list, since it will change these on parent font changing. The same applies to RichEdit.
But please note: Delphi's Combobox as well as some other controls like TCheckBox, TRadioButton, TButton are just wrappers of respective Windows controls and they will support RUSSIAN_CHARSET only when OS supports such charset. http://www.sicomponents.com/forum/viewtopic.php?t=12 may give you some details and ideas.
Charset is taken in account for RichEdit only in case its PlainText property is set to True.
When using DEFAULT_CHARSET it will be used the charset depending on user's OS locale information. So in case users have Russian OS installed they will be able to see Russian characters.
Munzig
Posts: 4
Joined: Thu Aug 26, 2004 2:09 pm

Charset

Post by Munzig »

Igor, thank you for your answer. The property ParentFont are false for my TRichEdit instances. When I set now PlainText to false the charset-list doesn’t appear in the Translation Editor. Only new instances will be shown in this list. How can I refresh it?

English Windows XP with default settings supports Russian text of a TComboBox when I set the Charset property. But its instance doesn’t show up in the charset list although ParentFont is false. Is there a way to get it in the list? Since I can see it in the object inspector, SiComponents should mange it in future, even if it is a wrapped Windows control. For the moment I have to do it with code.

I change e.g. TMemo from Russian (charset is RUSSIAN_CHARSET) into German (charset is empty). I expected that DEFAULT_CHARSET will be used as specified in the first English column. But German umlauts appear now as Russian letters. Means this that I have to specify always a charset and cannot use DEFAULT_CHARSET or leave it unspecified? Is it a bug? It seams that Tsilang doesn’t set it back to the default one.

The empty fields of Translation Editor’s charset and font list is not really consistent. Only the fist language is filled. But all columns should be initialised.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Dirk,

1. It looks like you don't use latest version available on our site, right? It contains some things related to Charsets fixed as well as other improvements.
2. When any "item" is empty in translations list TsiLang will act as following depending on TranslateType property settings:
- ttNoChange (default) - the current value won't be changed.
- ttGetDefault - there will be used the default (from first language) value.
So in your case when you have empty values for some Charsets TsiLang just doesn't change the property since I'm sure TranslateType is set to ttNoChange.
3. Actually, it is always better to specify correct Font and Charset for all languages and controls. The Propagate popup-menu item allows you easy and fast (in 2 mouse clicks) fill all controls with values from first item (usually Form component).
4. The appearance ot not of controls in Charsets list is controlling only :!: their ParentFont property, not PlainText or others. The fix for correct handling of this was implemented in later versions.
5. In Translation Editor there is even menu item "Tools|Settings|Auto-use Default Fonts" (again this was introduced in later versions) which allows to automatically insert values for Charset and Font depending on language name and settings from Default Fonts dialog when Translation Editor starts.

Quite long message :) Hope it will help you.
Munzig
Posts: 4
Joined: Thu Aug 26, 2004 2:09 pm

Charset

Post by Munzig »

Hi Igor,

1. I’m using version 3.5.1.1 under Delphi 4 and 7. There is missing the charset list for created TRichEdit and TComboBox objects. How can I force the creation of this list?

2./3. I use always ttGetDefault. But I’ll use never again DEFAULT_CHARSET for any language. Starting an application on an e.g. German OS, switching to Russian (ComboBox) and than back to German will replace German umlauts (ä, ö, ü, …) with Russian letters. The default charset seams not to stay static but replaced by Russian_Charset. DEFAULT_CHARSET is very dangerous if you change the language in runtime. For this reason it should be not present in the ComboBox of the Translation Editor.

4. As I explained: I’m missing the charset list for my created TRichEdit and TComboBox objects.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

To clear/update incorrectly created Charsets list:
1. Open Translation Editor
2. Go to Charsets and click Clear on tool bar
3. Go to fonts and click Clear on tool bar
4. Close Translation Editor.
5. Open Translation Editor (now it shall list all lists correctly).
Munzig
Posts: 4
Joined: Thu Aug 26, 2004 2:09 pm

TRichEdit and charset

Post by Munzig »

Thanks Igor. I was not aware of the clear function. TComboBox and TRichEdit are now present in the charsets and fonts lists. The charset of TComboBox is now correctly updated when I change the language.

There is still the problem with TRichEdit. Even when I specify the correct charset, the content of multilines is not displayed with Russian charset. ParentFont is false and PlainText is true.

All other used text objects (Tlabel, TComboBox, TMemo) are correctly displayed.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Unfortunately, TRichEdit is just wrapper of Windows control and will be able to display only characters supported by system Default Locale. So incase your system locale will be Russian you will be able to see Russian and English characters, but not German. In case of German locale you won't be able to see Russian.
The max what could be done is to use then RTF formatting. I've created a small sample which demonstrates this:
http://www.sicomponents.com/soft/demos/ ... ussian.zip
Post Reply