CnxManager |
||
dxgettext helpers |
File |
Defines |
Comment |
GTForm.pas |
TGTForm = class(TForm) |
This new TForm descendent introduces
the RefreshTranslation procedure. When called, this procedure
forces the given form (and the components it owns) to refresh itself
with the strings for the currently selected language. This is used by TGTLanguageFrame and thus you should change all your translatable forms to inherit from TGTForm rather than TForm. To do this, simply open the .pas file and replace = class(TForm) by = class(TGTForm), then recompile and everything should work. |
GTLanguagesEx.pas |
TLanguagesEx = class(TLanguages) GetInstalledLanguages() |
An extension of the TLanguages class
(bundled with Delphi) which allows to convert LangIds to ISO names and
vice-versa. The GetInstalledLanguages() function fills a TStrings with the list of installed languages in the given folder. This is based on code by Peter Thörnqvist. |
GTLanguageList.pas |
TGTLanguageList = class |
The list of currently available languages. This
list is used by TGTLanguageFrame
to fill its combo box |
GTLanguageFrame.pas GTLanguageFrame.dfm |
TGTLanguageFrame = class(TFrame) |
A frame that you can drop on any form
and that will let your user choose its language. All updating is done,
provided all the forms are descendants of TGTForm. Basically, you only need to use this one as it will call the others for you. |
languages.po |
template for the translation of languages |
This is taken directly from Lars' web site as
his list is far more complete. |
Ancestor |
TForm |
Properties |
none |
Methods |
procedure RefreshTranslation |
Forces the form to refresh its content to reflect the currently selected language. Will also refresh the strings of all the components it contains |
|
constructor Create |
|
Creates the required objects to perform automatic translation |
|
destructor Destroy |
|
Destroys the objects created by Create |
|
Events |
none |
Ancestor |
TLanguages |
Properties |
IDFromFromISO639Name[const
ISO639Name:string]:LCID |
Returns the LCID associated with the given ISO639 name (2 letter language abreviation) or 0 if the name was not found by the system. |
|
ISO639NameFromID[ID:LCID]:string |
|
Returns the ISO639 name (2 letter language abreviation) associated with the given LCID or an empty string if the LCID was not found by the system. |
|
IDFromFromISO3166Name[const
ISO3166Name:string]:LCID |
|
Returns the LCID associated with the given ISO3166 name (2 letter country abreviation) or 0 if the name was not found by the system. |
|
ISO3166NameFromID[ID:LCID]:string |
|
Returns the ISO3166 name (2 letter country abreviation) associated with the given LCID or an empty string if the LCID was not found by the system. |
|
GNUGetTextName[ID:LCID]:string |
|
Returns the name associated with this LCID as GNU gettext would expect it (fr_FR for instance) |
|
GNUGetTextID[const Name:string]:LCID |
|
Returns the LCID associated with this name, in GNU gettext format (fr_FR for instance) |
|
Methods |
constructor Create |
Creates the required objects for the class |
|
destructor Destroy |
|
Destroys the objects created by Create |
|
Events |
none |
Declaration |
procedure
GetInstalledLanguages(const BasePath,TextDomain:string;Strings:TStrings) |
Parameters |
BasePath |
The path where to look for the locale subfolder. Usually set to ExtractFilePath(Application.ExeName) |
|
TextDomain |
|
The name of the domain required for a language to be considered as installed. If set to an empty string, any domain will be enough. |
|
Strings |
|
The String list that will be filled with the available languages. Must be created before the call. |
Ancestor |
TObject |
|||||||||||||||||||
Properties |
Code[const name : string] :
string |
|||||||||||||||||||
Returns the GNU gettext code associated with that language name (in human readable format). |
||||||||||||||||||||
Codes : TStringList |
||||||||||||||||||||
Returns the list of language codes loaded in the list. |
||||||||||||||||||||
InstalledOnly : boolean |
||||||||||||||||||||
If true, the language list only contains the installed languages plus English (en) if it is not available on its own. |
||||||||||||||||||||
Name[const code : string] : string |
||||||||||||||||||||
Returns the human readable name associated with that GNU gettext code. |
||||||||||||||||||||
Names : TStringList |
||||||||||||||||||||
Returns the list of language names loaded in the list. |
||||||||||||||||||||
Methods |
constructor Create |
|||||||||||||||||||
Creates the required objects for the class |
||||||||||||||||||||
destructor Destroy |
||||||||||||||||||||
Destroys the objects created by Create |
||||||||||||||||||||
procedure LoadLanguages |
||||||||||||||||||||
Loads the languages, either from the list of installed languages for the application or using the default set of languages, depending on the value of InstalledOnly |
||||||||||||||||||||
Events |
none |
Ancestor |
TFrame |
Properties |
Name |
Returns the human readable name of the language selected in the combo box. |
|
Code |
|
Returns the GNU gettext code of the language selected in the combo box. |
|
InstalledOnly (published) |
|
If true, only the installed languages will be displayed. |
|
Methods |
constructor Create |
Updates the content of the combobox |
|
Events |
TOnGTBeforeLanguageChange =
procedure (Sender : TObject; Code : string) of object; OnGTBeforeLanguageChange : TOnGTBeforeLanguageChange (published) |
This event is triggered whenever the user has
changed the currently selected language but before it is actually made
the active language in the program. You may want to use this event to
save the item indexes
of comboboxes and lists as they will be reverted back to -1 as a result
of the update process. Note that this saving and restoration part could also be done more efficiently in an overriden RefreshTranslation() procedure of your forms. Store before calling inherited, restore after. |
|
TOnGTLanguageChanged = procedure
(Sender : TObject; Code : string) of object; OnGTLanguageChanged : TOnGTLanguageChanged (published) |
|
This event is triggered whenever the user has
changed the currently selected language. You may want to use this event
to reaffect the item indexes of comboboxes and lists as they will be
reverted back to -1 as a result of the update process. Note that this saving and restoration part could also be done more efficiently in the RefreshTranslation() overriden procedure of your forms. Store before calling inherited, restore after. |