CmsLangOperations View code

A singleton class to provide simple, generic mechanism for dealing with languages encodings, and locales. This class does not handle translation strings.

package

CMS

license

GPL

author

Robert Campbell

since 1.11

Methods

lang_key_exists() : boolean

Given a realm name, and a key test if the language string exists in the realm.

static

Response

boolean

lang_from_realm() : string

Given a realm name, a key, and optional parameters return a translated string This function accepts variable arguments. If no key/realm combination can be found then an -- Add-Me string will be returned indicating that this key needs translating.

static

This function uses the currently set language, and will load the translations from disk if necessary.

Response

string

lang() : string

A simple around the lang_from_realm method that assumes the self::CMSMS_ADMIN_REALM realm.

static

Note, under normal circumstances this will generate an error if called from a frontend action. This function accepts variable arguments.

Response

string

key_exists(string $key, string $realm = null) : boolean

Test to see if a language key exists in the current lang file.

static

This function uses the current language.

Arguments

string $key

The language key

string $realm

The language realm

Response

boolean

set_realm(string $realm = self::CMSMS_ADMIN_REALM) : string

Set the realm for further lang calls.

static

Arguments

string $realm

The realm name. If no name specified, self::CMSMS_ADMIN_REALM is assumed'

Response

string

the old realm name.

Constants

A constant for the core admin realm.

CMSMS_ADMIN_REALM