PHP Class L10n, BicBucStriim

显示文件 Open project: rvolz/BicBucStriim Class Usage Examples

Public Properties

Property Type Description
$langa array Messages of primary localization language
$langb array Messages of fallback localization language
$user_lang string User language

Public Methods

Method Description
__construct ( string $lang ) Find the user language, either one of the allowed languages or English as a fallback. Store the English messages as an alternative for incomplete translations.
message ( string $id ) : string Return a localized message string for $id.
offsetExists ( $id ) Implement this part of the Array interface for easier access by the templates.
offsetGet ( $id ) Implement this part of the Array interface for easier access by the templates.

Method Details

__construct() public method

Find the user language, either one of the allowed languages or English as a fallback. Store the English messages as an alternative for incomplete translations.
public __construct ( string $lang )
$lang string user language (according to client)

message() public method

If there is no defined message for $id in the current language the function looks for an alterantive in English. If that also fails an error message is returned. If $id is NULL or '' the empty string will be returned.
public message ( string $id ) : string
$id string message id
return string localized message string

offsetExists() public method

Always return true, because then ::message will return an error string for undefined IDs.
public offsetExists ( $id )

offsetGet() public method

Just call ::message.
public offsetGet ( $id )

Property Details

$langa public_oe property

Messages of primary localization language
public array $langa
return array

$langb public_oe property

Messages of fallback localization language
public array $langb
return array

$user_lang public_oe property

User language
public string $user_lang
return string