Announcement

Collapse
No announcement yet.

Programm umstellen : Konzept, Aufwand ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programm umstellen : Konzept, Aufwand ?

    Es ist ein DElphi-Programm (Win2000, Delphi 5 Enterprise) auf folgende
    Sprachen wenigstens visuell umzustellen (Tastatur mal außen vorlassen):
    !!ENGLISCH!!,FRANZÖSISCH,ITALIENISCH,SPANISCH,PORT UGISISCH
    Konzept(?):
    rc-files zur Laufzeit laden ? wie,wo,was ?
    mir schwebt da eher eine DB-basierte Lösung vor, die Labels u. Buttons,Menues zur Laufzeit neu beschriftet bei FormCreate
    Wie kann das (zeitnah->kostengünstig) am besten gemacht werden ?

    MfG Wolf

  • #2
    Habe mein Projekt durch ein Ressource File übersetzt und ca. 50 Zeilen Delphi-Quellcode.
    Ich ändere damit ca. 1000 Beschriftungen (TLabel, TButton, TCheckbox,
    TTabSheet, TGroupBox, TRadioButton, TQRLabel usw.) und sogar aus
    meiner Datenbank das Displayformat von z.B. (#,###.#0 'Std')
    in (#,###.#0 'h') in Bruchteilen einer Sekunde auf 13 Formularen.
    Den Ressourcen Editor gibt es als Freeware. Falls Du weitere Fragen oder den Quellcode dazu benötigtst sag mir Bescheid

    Comment


    • #3
      Der Quelltext wäre hier bestimmt interessant. 50 Zeilen lassen sich ja auch noch gut hier poste

      Comment


      • #4
        implementation

        uses Forms,StdCtrls, ExtCtrls,Menus,SysUtils,Windows,
        ComCtrls,QrCtrls,Db,DBCtrls,Buttons;

        {$R sprache.res}

        procedure Spracheinstellung(offset:Integer);
        var i,j: integer;
        c : TObject;

        function GetResString(Nr: Integer): String;
        var p: PChar;
        begin
        p := StrAlloc(256);
        LoadString(Hinstance,nr+offset,p,255);
        result := p;
        StrDispose(p);
        end;

        begin
        with application do for i := 0 to ComponentCount-1 do begin
        for j := 0 to Components[i].ComponentCount-1 do begin
        if Components[i].Components[j].tag <> 0 then begin
        c := Components[i].Components[j];

        if (c is TLabel) then (c as TLabel).caption := GetResString((c as TLabel).tag);
        if (c is TButton) then (c as TButton).caption := GetResString((c as TButton).tag);
        if (c is TCheckbox) then (c as TCheckbox).caption := GetResString((c as TCheckbox).tag);
        if (c is TMenuitem) then (c as TMenuitem).caption := GetResString((c as TMenuitem).tag);
        if (c is TTabSheet) then (c as TTabSheet).caption := GetResString((c as TTabSheet).tag);
        if (c is TToolButton) then (c as TToolButton).hint := GetResString((c as TToolButton).tag);
        if (c is TGroupBox) then (c as TGroupBox).caption := GetResString((c as TGroupBox).tag);
        if (c is TRadioButton) then (c as TRadioButton).caption := GetResString((c as TRadioButton).tag);
        if (c is TQRLabel) then (c as TQRLabel).caption := GetResString((c as TQRLabel).tag);
        if (c is TDBCheckBox) then (c as TDBCheckBox).caption := GetResString((c as TDBCheckBox).tag);
        if (c is TBitBtn) then (c as TBitBtn).caption := GetResString((c as TBitBtn).tag);
        if (c is TBitBtn) then (c as TBitBtn).Hint := GetResString((c as TBitBtn).tag);
        if (c is TFloatField) then (c as TFloatField).DisplayFormat := GetResString((c as TFloatField).tag);

        { Hier die anderen Objekte, die übersetzt werden sollen hinzufügen }
        {Die Idee ist ursrünglich von Thomas Kowalski und Walter Doberenz aus dem Kochbuch Borland Delphi 5}
        end;
        end;
        end;
        end;

        end.

        Aufruf erfolgt durch die Procedure

        Spracheinstellung(Sp_English);

        ----------------------------------------------------------------------------------
        Bei Problemen oder weiteren Fragen schicke mir eine kurze E-Mail an [email protected]

        Bis dan

        Comment

        Working...
        X