Support for multiple languages

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Frede
Newbie
Newbie
Posts: 7
Joined: Fri Feb 01, 2008 12:00 am

Support for multiple languages

Post by Frede » Wed Dec 03, 2008 10:27 am

Hello, We have TeeChart Pro which I understand comes with support for some 25+ languages. We use TeeChart in Delphi 2007 Win VCL.
How can we enable multi-language support for our charts. That is, the chart property pages should display localized strings. I know it is possible to set the language directly on the TChart component by cliking Options and change the language there, but of course I want the chart to be in English if the user selected English as his language and Spanish if the user selected Spanish as his language in Windows.
How can I do this and what files do I need to distribute to make this work?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 03, 2008 10:37 am

Hi Frede,

Yes, this is possible. You'll find an example of this at All Features\Welcome!\Miscellaneous\Multi-Language in the new features demo available at TeeChart's program group. You don't need to distribute any specific file for that.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Frede
Newbie
Newbie
Posts: 7
Joined: Fri Feb 01, 2008 12:00 am

Post by Frede » Wed Dec 03, 2008 11:03 am

wow, that was fast!

I have look at the source code for the sample and as I understand it I just need to call the ChangeLanguage procedure to set the language of TeeChart. Will this change the language of any TeeChart control on the current form or do I need to call TranslateControl as well? I only need to translate the chart editor, not anything else.
Also as I understand it I need to use ChangeLanguage on every form that use a TChartEditor, and I cannot set this globally. It would have been great if you could create a registry key or similar that TeeChart could read and set the language accrodingly.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 03, 2008 12:01 pm

Hi Frede,
I have look at the source code for the sample and as I understand it I just need to call the ChangeLanguage procedure to set the language of TeeChart. Will this change the language of any TeeChart control on the current form or do I need to call TranslateControl as well? I only need to translate the chart editor, not anything else.
This is not necessary then. Just setting the language you wish to use is enough, for example:

Code: Select all

uses TeeCatalan;

procedure TForm1.FormCreate(Sender: TObject);
begin
  TeeSetCatalan;
end;
Also as I understand it I need to use ChangeLanguage on every form that use a TChartEditor, and I cannot set this globally. It would have been great if you could create a registry key or similar that TeeChart could read and set the language accrodingly.
Yes, you can set this in the HKEY_CURRENT_USER\Software\Steema Software\TeeChart Pro\Editor key, changing the value of Language property.

Actually this can also be done by right-clicking on a chart and choosing Options.

You may also be interested in looking at the Design Options example in the features demo. Go to Search tab and search for ChangeLanguage.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Frede
Newbie
Newbie
Posts: 7
Joined: Fri Feb 01, 2008 12:00 am

Post by Frede » Wed Dec 03, 2008 12:14 pm

Great, I have set the langauge options in the registry to Swedish (REG_DWORD 13) by using Options on a TChart component. However when I launch my app, everything is still in English. I must also call TChartMultiLanguage.ChangeLanguage(TeeLanguageRegistry); as well I suppose?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 03, 2008 1:01 pm

Hi Frede,

Yes, you need to do something like this:

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeeComma, ExtCtrls, TeeProcs, TeEngine, Chart;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    TeeCommander1: TTeeCommander;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    class procedure ChangeLanguage(ALanguage:Integer);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

Uses
    TeeConst, TeeProCo, { <-- English }

     // Languages
     TeeSpanish,
     TeeGerman,
     TeeCatalan,
     TeeFrench,
     TeeDanish,
     TeeDutch,
     TeeChinese,
     TeeChineseSimp,
     TeeBrazil,
     TeeSwedish,
     TeePortuguese,
     TeeRussian,
     TeeSlovene,
     TeeNorwegian,
     TeeJapanese,
     TeePolish,
     TeeTurkish,
     TeeHungarian,
     TeeItalian,
     TeeArabic,
     TeeHebrew,
     TeeUkrainian,
     TeeKorean,
     TeeIndonesian,
     TeeGalician,
     TeeFinnish,
     TeeSlovak,
     TeeHellenic,
     TeeRomanian,
     TeeSerbian,
     TeeFarsi,
     TeeCzech,
     TeeHindi,
     TeeUrdu,

     // Ask Language editor dialog
     TeeTranslate;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ChangeLanguage(TeeLanguageRegistry);
end;

class procedure TForm1.ChangeLanguage(ALanguage:Integer);
begin
  Case ALanguage of
    1: TeeSetBrazil;
    2: TeeSetCatalan;
    3: TeeSetChineseSimp;
    4: TeeSetChinese;
    5: TeeSetDanish;
    6: TeeSetDutch;
    7: TeeSetFrench;
    8: TeeSetGerman;
    9: TeeSetItalian;
   10: TeeSetPortuguese;
   11: TeeSetRussian;
   12: TeeSetSpanish;
   13: TeeSetSwedish;
   14: TeeSetNorwegian;
   15: TeeSetJapanese;
   16: TeeSetPolish;
   17: TeeSetSlovene;
   18: TeeSetTurkish;
   19: TeeSetHungarian;
   20: TeeSetGalician;
   21: TeeSetArabic;
   22: TeeSetHebrew;
   23: TeeSetUkrainian;
   24: TeeSetKorean;
   25: TeeSetIndonesian;
   26: TeeSetFinnish;
   27: TeeSetSlovak;
   28: TeeSetHellenic;
   29: TeeSetRomanian;
   30: TeeSetSerbian;
   31: TeeSetFarsi;
   32: TeeSetCzech;
   33: TeeSetHindi;
   34: TeeSetUrdu;
  else
    TeeSetEnglish;
  end;
end;

end.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Frede
Newbie
Newbie
Posts: 7
Joined: Fri Feb 01, 2008 12:00 am

Post by Frede » Wed Dec 03, 2008 1:16 pm

Thanks again,

Sorry, it DOES work! i was looking in the wrong place.

Onle last question though. Does it really have to be a class procedure. Can I not just call ChangeLanguage before ChartEditor.Execute?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 03, 2008 1:56 pm

Hi Frede,

Yes, it works too and I don't think there's any inconvenient in doing so. I think it was implemented that way because it was declared in another class.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Frede
Newbie
Newbie
Posts: 7
Joined: Fri Feb 01, 2008 12:00 am

Post by Frede » Wed Dec 03, 2008 1:57 pm

Yes, I tried to make it just a private procedure and it works just as well.

Thank you for excellent support!

Frede
Newbie
Newbie
Posts: 7
Joined: Fri Feb 01, 2008 12:00 am

What about TeeChart in ReportBuilder

Post by Frede » Mon Dec 08, 2008 8:17 am

Hi again,

A related question. Is it possible to set the language in a similar way when I use TeeChart in ReportBuilder? That is, if I drop a TeeChart component on a report in design view, I'd like the editing chart dialog to be in a specific language. How can I accomplish that?

wwp3321
Newbie
Newbie
Posts: 60
Joined: Wed Jul 02, 2003 4:00 am

Post by wwp3321 » Tue Dec 09, 2008 4:26 am

Thanks! :D

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 09, 2008 12:26 pm

Hello,

I'm afraid you should ask Digital Metaphors (ReportBuilder manufacturers) for that since they are the ones who make the TeeChart wrapper for ReportBuilder.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply