class Lang

Class Lang — a class for working with localization dictionaries.

Example:

<?php

$lang = Lang::lang();

echo $lang->NAME;

The system automatically adds a default localization dictionary based on system configuration settings.

class Lang

{

/**
* Set default localization
* @param string $name
* @throws Exception
*/

static public function setDefaultDictionary($name)

/**
* Add localization dictionary
* @param string $name — localization name
* @param Config_Abstract $dictionary — configuration object
*/

static public function addDictionary($name , Config_Abstract $dictionary)

/**
* Get a localized string by dictionary key.
* If the necessary key is absent, the following value will be returned:
* «[key]»
* @param string $key
* @return string
*/

public function get($key)

/**
* Convert the localization dictionary to JSON
* @return string
*/

public function getJson()

/**
* Convert the localization dictionary to JavaScript object
* @return string
*/

public function getJsObject()

/**
* Get link to localization dictionary by localization name or
* get default dictionary
* @param string $name optional,
* @throws Exception
* @return Lang
*/

static public function lang($name = false)

}

comments powered by Disqus