EF.Localization
This unit defines an interface for localization libraries to plug into. All the units in EF send their strings to this stub, which in turn directs them to whatever localization tool is used to localize an application.@br To plug a localization tool, you need to implement IEFLocalizationTool in a class of your choice and register it by calling TEFLocalizationToolRegistry.RegisterLocalizationTool. This is usually done in a unit's initialization section.
IEFLocalizationTool interface
The localization tool interface.
function TranslateString(const AString: string;Translates a string in the default language to a string in the current language. Some tools file strings giving an Id to each of them. A particular tool might require you to pass AIdString, an opaque string that uniquely identifies the string to translate.
procedure TranslateComponent(const AComponent: TComponent);Translates all the string properties in Component and all the components it owns from the default language to the current language. It is usually called for each dfm-based form that is created.
procedure ForceLanguage(const ALanguageId: string);Forces the use of a particular language instead of the system default.
function GetCurrentLanguageId: string;Returns the Id of the currently used language.
TEFLocalizationToolRegistry class
Keeps track of the currently active localization tool.
class procedure RegisterTool(const ATool: IEFLocalizationTool);Sets the current tool to ATool. Pass nil to set the current tool back to the default tool.
class procedure UnregisterTool;Same as RegisterTool(nil);
TEFNullLocalizationTool class
This class implements the default localization tool, which does nothing.
function AsObject: TObject;Returns the implementing object (Self).
function TranslateString(const AString: string;Returns AString unchanged (no translation is performed).
procedure TranslateComponent(const AComponent: TComponent);Does nothing (no translation is performed).
procedure ForceLanguage(const ALanguageId: string);Does nothing (no language switching is performed).
function GetCurrentLanguageId: string;Returns '' (no current language is tracked).
Routines
function TranslateString(const AString: string;Shortcut for TEFLocalizationToolRegistry.CurrentTool.TranslateString.
Parameters:
AString— String to translate. If the string is enclosed by '_(' and ')', these characters are stripped.
function _(const AString: string;Shortcut for TEFLocalizationToolRegistry.CurrentTool.TranslateString.
Parameters:
AString— String to translate. If the string is enclosed by '_(' and ')', these characters are stripped.
