CMS Made Simple API

CmsLangOperations
in package

FinalYes

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

Tags
license

GPL

author

Robert Campbell

since
1.11

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

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
bool

lang()

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
see
lang_from_realm
Return values
string

lang_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
string

lang_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
since
2.2
Return values
bool

set_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
since
2.0
author

Robert Campbell

Return values
string

the old realm name.


        
On this page

Search results