Lazarus Localisation Helper

This is an old revision of Lazarus Localisation Helper, edited by Paskal at . The current revision is 150622.

/* Description */

Description

Lazarus Localisation Helper is an LPK, but it contains a single .pas, so it can be added to any project.

It's purpose is to make localisation easier.

1. Autodetect and apply a proper language (usually done on the first run of an app).

Example: If your OS is set to es_VE,  and it happens to be unavailable, the app will select es_UY (if available), or some other es_xx.

2. Creates and handles the language selection controls - TMenuItem, TPopupMenu or TComboBox. You can use all of them simultaneously, in case you find a reason to.

3. All you you need to type is couple of lines:

CreateLanguageMenuItems(TargetControl);
    SetLocalLanguage //Usually this is the first run of the app
    {or} SetAppLang(POFileName); //if you are retriving the languge from settings.

An example app is available in the source code.

Where is it

https://sourceforge.net/projects/lochelper/

It is not available in [OPM|Online_Package_Manager].

Events

The following events are supported:

1. OnBeforeLanguageChange

Triggerred just before the language is changed, intended use is to store properties, which might be changed by localisation, for example .ItemIndex of a combo box.

Usage :

OnBeforeLanguageChange := @DoOnBeforeLanguageChange;

2. OnLanguageChanged, triggered after the language is changed. Intended use is to restore properties affected during the change of the language, or to force localisation of properties, which are not translated atomatically, like the .Items of TComboBox.

Usage :

OnLanguageChanged := @DoLanguageChanged;

//Do some addtional things, if required, for example update combo boxes or add custom title of the main form

What else

I localised two or three apps with it, seems to do fine so far, saves a lot of effort and time. Feedback is welcome, especially negative.