Class TCastleLocalization

Unit

Declaration

type TCastleLocalization = class(TComponent)

Description

Main comonent for localization, singleton as Localization.

Hierarchy

  • TComponent
  • TCastleLocalization

Overview

Fields

Protected FLanguageDictionary: TLanguageDictionary;
Protected FLanguageURL: String;
Protected FFileLoaderDictionary: TFileLoaderDictionary;
Protected FLocalizationIDList: TLocalizationIDList;
Protected FOnUpdateLocalizationEventList: TOnUpdateLocalizationEventList;
Protected FOnLocalizationUpdatedEventList: TOnLocalizationUpdatedEventList;

Methods

Protected function Get(AKey: String): String;
Protected procedure LoadLanguage(const ALanguageURL: String);
Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Protected function AddOrSet(AOnUpdateLocalizationEvent: TOnUpdateLocalizationEvent; const ALocalizationID: String): Boolean; overload; inline;
Protected procedure RemoveFromUpdateList(AOnUpdateLocalizationEvent: TOnUpdateLocalizationEvent); inline;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function SystemLanguage(const ADefaultLanguage: String = SystemDefaultLanguage): String; inline;
Public function SystemLocale(const ADefaultLocale: String = SystemDefaultLocale): String; inline;
Public procedure AddOrSet(ALocalizationComponent: ICastleLocalization; const ALocalizationID: String); overload;
Public procedure AddOrSet(ALocalizationComponent: ICastleLocalizationCustom; const ALocalizationID: String); overload;

Properties

Public property Items[AKey:String]: String read Get;
Public property LanguageURL: String read FLanguageURL write LoadLanguage;
Public property FileLoader: TFileLoaderDictionary read FFileLoaderDictionary;
Public property OnUpdateLocalization: TOnLocalizationUpdatedEventList read FOnLocalizationUpdatedEventList;

Description

Fields

Protected FLanguageDictionary: TLanguageDictionary;
 
Protected FLanguageURL: String;
 
Protected FFileLoaderDictionary: TFileLoaderDictionary;
 
Protected FLocalizationIDList: TLocalizationIDList;
 
Protected FOnUpdateLocalizationEventList: TOnUpdateLocalizationEventList;
 
Protected FOnLocalizationUpdatedEventList: TOnLocalizationUpdatedEventList;
 

Methods

Protected function Get(AKey: String): String;
 
Protected procedure LoadLanguage(const ALanguageURL: String);
 
Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
 
Protected function AddOrSet(AOnUpdateLocalizationEvent: TOnUpdateLocalizationEvent; const ALocalizationID: String): Boolean; overload; inline;
 
Protected procedure RemoveFromUpdateList(AOnUpdateLocalizationEvent: TOnUpdateLocalizationEvent); inline;
 
Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public function SystemLanguage(const ADefaultLanguage: String = SystemDefaultLanguage): String; inline;

Returns the current system language as language code. For example: en, de, pl

Public function SystemLocale(const ADefaultLocale: String = SystemDefaultLocale): String; inline;

Returns the current system locale as langauge code and locale info. For example: en_US, en_GB, es_ES

Public procedure AddOrSet(ALocalizationComponent: ICastleLocalization; const ALocalizationID: String); overload;

Adds a new component to the automised localization list or, if it already is listed, updates it's localization ID. If ALocalizationID is empty, the element is removed from the localization list.

Public procedure AddOrSet(ALocalizationComponent: ICastleLocalizationCustom; const ALocalizationID: String); overload;

Adds a new custom localization class to the automised localization list or, if it already is listed, updates it's localization ID. If ALocalizationID is empty, the element is removed from the localization list.

Properties

Public property Items[AKey:String]: String read Get;
 
Public property LanguageURL: String read FLanguageURL write LoadLanguage;

The URL to the language file that shall be loaded for localization.

Public property FileLoader: TFileLoaderDictionary read FFileLoaderDictionary;

A list (dictionary) of file loaders. You can use this to add custom file loader for new file extensions or overwrite existing ones to change the file format.

Public property OnUpdateLocalization: TOnLocalizationUpdatedEventList read FOnLocalizationUpdatedEventList;

A list of subscribed procedures of that each will be called when the langauge changes. You can add a procedure to this to localise images or such that is no descendent of TComponent.


Generated by PasDoc 0.15.0.