Page 1 of 1

Support for multiple languages

Posted: Wed Dec 03, 2008 10:27 am
by 10548198
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?

Posted: Wed Dec 03, 2008 10:37 am
by narcis
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.

Posted: Wed Dec 03, 2008 11:03 am
by 10548198
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.

Posted: Wed Dec 03, 2008 12:01 pm
by narcis
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.

Posted: Wed Dec 03, 2008 12:14 pm
by 10548198
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?

Posted: Wed Dec 03, 2008 1:01 pm
by narcis
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.

Posted: Wed Dec 03, 2008 1:16 pm
by 10548198
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?

Posted: Wed Dec 03, 2008 1:56 pm
by narcis
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.

Posted: Wed Dec 03, 2008 1:57 pm
by 10548198
Yes, I tried to make it just a private procedure and it works just as well.

Thank you for excellent support!

What about TeeChart in ReportBuilder

Posted: Mon Dec 08, 2008 8:17 am
by 10548198
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?

Posted: Tue Dec 09, 2008 4:26 am
by 8574101
Thanks! :D

Posted: Tue Dec 09, 2008 12:26 pm
by narcis
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.