* Gets a specified language expression defined in configuration file
*
* @param string $key the configuration key matching the value to get
* @return string The value in the configuration file
* @deprecated
*/
functionlang_get($key){
trigger_error("The use of the L10n global functions is deprecated. Call Language::get('$key') instead.",E_USER_DEPRECATED);
returnLanguage::get($key);
}
/**
* Language services
*/
classLanguageimplementsLoadableWithContext{
///
/// Properties
///
/**
* @var
*/
constFALLBACK='en';
/**
* @var Smarty the template engine
*/
private$templateEngine;
///
/// Singleton pattern. Constructor.
///
/**
* @var Language The loaded Language instance
*/
privatestatic$instance;
/**
* Loads an instance of the class
*
* @param Context $context The context
* @return Language An instance of the Language class
*/
publicstaticfunctionLoad(Context$context=null){
if(static::$instance===null){
//Initializes an instance
if($context===null){
thrownewInvalidArgumentException("A context is required to load this class for the first time.");
}
if($context->templateEngine===null){
thrownewInvalidArgumentException("A context is required to load this class for the first time. You provided one, but the template engine isn't initiliazed. This is required, as the languages files are managed by the template engine.");