CmsLangOperations
in package
A singleton class to provide simple, generic mechanism for dealing with languages encodings, and locales. This class does not handle translation strings.
Tags
Table of Contents
Constants
- CMSMS_ADMIN_REALM = 'admin'
- A constant for the core admin realm.
Methods
- key_exists() : bool
- Test to see if a language key exists in the current lang file.
- lang() : string
- A simple around the lang_from_realm method that assumes the self::CMSMS_ADMIN_REALM realm.
- 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.
- lang_key_exists() : bool
- Given a realm name, and a key test if the language string exists in the realm.
- set_realm() : string
- Set the realm for further lang calls.
Constants
CMSMS_ADMIN_REALM
A constant for the core admin realm.
public
mixed
CMSMS_ADMIN_REALM
= 'admin'
Methods
key_exists()
Test to see if a language key exists in the current lang file.
public
static key_exists(string $key[, string $realm = null ]) : bool
This function uses the current language.
Parameters
- $key : string
-
The language key
- $realm : string = null
-
The language realm
Return values
boollang()
A simple around the lang_from_realm method that assumes the self::CMSMS_ADMIN_REALM realm.
public
static lang() : string
Note, under normal circumstances this will generate an error if called from a frontend action. This function accepts variable arguments.
Tags
Return values
stringlang_from_realm()
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.
public
static lang_from_realm() : string
This function uses the currently set language, and will load the translations from disk if necessary.
Return values
stringlang_key_exists()
Given a realm name, and a key test if the language string exists in the realm.
public
static lang_key_exists() : bool
Tags
Return values
boolset_realm()
Set the realm for further lang calls.
public
static set_realm([string $realm = self::CMSMS_ADMIN_REALM ]) : string
Parameters
- $realm : string = self::CMSMS_ADMIN_REALM
-
The realm name. If no name specified, self::CMSMS_ADMIN_REALM is assumed'
Tags
Return values
string —the old realm name.