Class TWPLanguageControl
Hierarchy
System.TObject | System.Classes.TPersistent | System.Classes.TComponent | WPXMLint.TWPCustomXMLInterface | WPXMLint.TWPCustomXMLTree | TWPLanguageControl
Description
TWPLanguageControl is used to translate the captions of labels and other components on a form at runtime. It is based on the component TWPCustomXMLTree and stores the translation as XML data.How to use the TWPLanguageControl:
1) There may be only one LanguageControl in the project. It may be never freed!
2) In the event OnLoaded use this code to initialize the control
procedure TForm1.WPLanguageControl1Loaded(Sender: TObject); begin WPLangInterface := TWPLocalizationInterface.Create(WPLanguageControl1); WPLocalizeAllStrings; end;
3) You will find XML files in Demos\Tasks\Localization. Double click on the object to load / merge the data. The demo can be used to test the localization! Set property GlobalLanguage to the required language ID, i.e. 'DE'
Methods
Procedure LoadForm(Name:string; Form:TWinControl; Menus:Boolean; Captions:Boolean; Hints:Boolean)
Function LoadString(Name:string; Text:string; Charset:Integer) : Boolean
Function LoadStrings(Name:string; Entries:TStrings; Charset:Integer) : Boolean
Procedure SaveForm(Name:string; Form:TWinControl; Menus:Boolean; Captions:Boolean; Hints:Boolean)
Function SaveFormEx(Name:string; Form:TWinControl; Menus:Boolean; Captions:Boolean; Hints:Boolean) : TWPXMLOneLevel
Procedure SaveString(Name:string; Text:string; Charset:Integer)
Procedure SaveStrings(Name:string; Entries:TStrings; Charset:Integer)
Events
AfterLoadForm : TWPLanguageControlAfterEvent= TWPLanguageControlAfterEvent
AfterSaveForm : TWPLanguageControlAfterEvent= TWPLanguageControlAfterEvent
BeforeLoadForm : TWPLanguageControlBeforeEvent= TWPLanguageControlBeforeEvent
BeforeSaveForm : TWPLanguageControlBeforeEvent= TWPLanguageControlBeforeEvent
OnLoaded : TNotifyEvent= procedure (Sender : TObject) of Object
WPLocalLOadObjectStrings : TWPLocalLoadObjectStrings= TWPLocalLoadObjectStrings
WPLocalSaveObjectStrings : TWPLocalSaveObjectStrings= TWPLocalSaveObjectStrings
Used or referenced by
-Function TWPXMLOneLevel.CopyTree(NewParent:TWPCustomXMLTree) : TWPXMLOneLevel |
-Function TWPXMLOneLevel.CopyTree(NewParent:TWPCustomXMLTree) : TWPXMLOneLevel |