ZenMagick 0.9.10


org.zenmagick.core.services.locale\ZMLocale
core\services\locale\ZMLocale.php at line 30

Interface ZMLocale

ZMLocale

public interface ZMLocale

Locale resolver.

Author:
DerManoMann

Constant Summary
final static str

DEFAULT_DOMAIN

Method Summary
string

getCode()

Get the active locale code.

string

getFormat(string group, string type)

Get a format.

string

getName()

Get the locale name.

string

init(string locale)

Init locale.

string

translate(string text, mixed context, string domain)

Translate the given text.

string

translatePlural(string single, int number, string plural, mixed context, string domain)

Translate the given text with plural option.

Constant Detail

core\services\locale\ZMLocale.php at line 31

DEFAULT_DOMAIN

public final static str DEFAULT_DOMAIN = 'defaults'

Method Detail

core\services\locale\ZMLocale.php at line 39

getCode

public string getCode()

Get the active locale code.

Returns:
The current locale code.

core\services\locale\ZMLocale.php at line 92

getFormat

public string getFormat(string group, string type)

Get a format.

Parameters:
group - The format group. Can be one of date or time.
type - One of short or long.
Returns:
A format string or null.

core\services\locale\ZMLocale.php at line 46

getName

public string getName()

Get the locale name.

Returns:
The name.

core\services\locale\ZMLocale.php at line 61

init

public string init(string locale)

Init locale.

Init the configured locale implementation. This includes creating the singleton instance of the locale and calling init($locale) on the locale instance.

The locale instance, in turn, will typically try to load the default language mappings for the locale/language given. Depending on the actual implementation used this can be a file (yaml, mo) or just a static map kept in memory.

Parameters:
locale - The locale to be used in the form: [language code]_[country code] or just [language code]; for exampe de_DE, en_NZ or es.
Returns:
The locale base path.

core\services\locale\ZMLocale.php at line 71

translate

public string translate(string text, mixed context, string domain)

Translate the given text.

Parameters:
text - The text to translate.
context - Optional translation context; default is null.
domain - The translation domain; default is ZMLocale::DEFAULT_DOMAIN.
Returns:
The translated text.

core\services\locale\ZMLocale.php at line 83

translatePlural

public string translatePlural(string single, int number, string plural, mixed context, string domain)

Translate the given text with plural option.

Parameters:
single - The text to translate for single case.
number - The number.
plural - The text to translate for plural case; default is null to default to the single case.
context - Optional translation context; default is null.
domain - The translation domain; default is ZMLocale::DEFAULT_DOMAIN.
Returns:
The translated text or, if no translation found, the original text.

ZenMagick 0.9.10