| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- //---------------------------------------
- // This unit is part of the GLSViewer
- //---------------------------------------
- unit fGLForm;
- (* The fGLForm unit for TGLForm class as parent for all child forms of GLSViewer *)
- interface
- uses
- Winapi.Windows,
- System.SysUtils,
- System.IniFiles,
- Vcl.Forms,
- Vcl.Graphics,
- Vcl.Menus,
- Vcl.Actnlist,
- gnuGettext;
- type
- TGLForm = class(TForm)
- procedure FormCreate(Sender: TObject);
- private
-
- public
- IniFile : TIniFile;
- procedure ReadIniFile; virtual;
- procedure WriteIniFile; virtual;
- procedure SetLanguage;
- end;
- var
- GLForm: TGLForm;
- LangID : Word;
- implementation
- {$R *.dfm}
- //Here goes the translation of all component strings
- //
- procedure TGLForm.FormCreate(Sender: TObject);
- begin
- inherited;
- SetLanguage;
- end;
- //----------------------------------------------------------
- procedure TGLForm.SetLanguage;
- var
- LocalePath : TFileName;
- IniFile : TIniFile;
- begin
- LocalePath := ExtractFileDir(ParamStr(0)); // Path to GLSViewer
- LocalePath := LocalePath + PathDelim + 'Locale' + PathDelim;
- ReadIniFile;
- if (LangID <> LANG_ENGLISH) then
- begin
- Textdomain('glsviewer');
- BindTextDomain ('glsviewer', LocalePath);
- AddDomainForResourceString('language');
- BindTextDomain ('language', LocalePath);
- //TP_GlobalIgnoreClass(TTable);
- //TP_GlobalIgnoreClass(TFields);
- //TP_GlobalIgnoreClass(TFont);
- //TP_GlobalIgnoreClass(TListBox);
- //TP_GlobalIgnoreClass(TStaticText);
- //TP_GlobalIgnoreClass(TGLLibMaterial);
- //TP_GlobalIgnoreClass(TGLMaterialLibrary);
- TP_IgnoreClass(TFont);
- TP_GlobalIgnoreClassProperty(TAction, 'Category');
- // Removing the upper line will cause long loading but Action.Category translation
- case LangID of
- LANG_RUSSIAN:
- begin
- UseLanguage('ru');
- Application.HelpFile := UpperCase(LocalePath + 'ru'+ PathDelim+'GLSViewer.chm');
- end;
- LANG_SPANISH:
- begin
- UseLanguage('es');
- Application.HelpFile := UpperCase(LocalePath + 'es'+ PathDelim+'GLSViewer.chm');
- end;
- LANG_GERMAN:
- begin
- UseLanguage('de');
- Application.HelpFile := UpperCase(LocalePath + 'de'+ PathDelim+'GLSViewer.chm');
- end;
- LANG_FRENCH:
- begin
- UseLanguage('fr');
- Application.HelpFile := UpperCase(LocalePath + 'fr'+ PathDelim+'GLSViewer.chm');
- end
- else
- begin
- UseLanguage('en');
- Application.HelpFile := UpperCase(LocalePath + 'en'+ PathDelim+'GLSViewer.chm');
- end;
- end;
- end
- else
- begin
- UseLanguage('en');
- Application.HelpFile := UpperCase(LocalePath + 'en'+ PathDelim+'GLSViewer.chm');
- end;
- TranslateComponent(Self);
- //TP_GlobalIgnoreClass(TGLLibMaterial);
- //TP_GlobalIgnoreClass(TGLMaterialLibrary);
- //TP_GlobalIgnoreClass(TListBox);
- //TP_GlobalIgnoreClassProperty(TAction, 'Category');
- end;
- procedure TGLForm.ReadIniFile;
- begin
- IniFile := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini'));
- with IniFile do
- try
- LangID := ReadInteger('GLOptions', 'RadioGroupLanguage', 0);
- finally
- IniFile.Free;
- end;
- end;
- procedure TGLForm.WriteIniFile;
- begin
- //
- end;
- end.
|