Avoid creating multiple instances of Translator
This commit is contained in:
@@ -26,6 +26,31 @@ class Translator
|
||||
*/
|
||||
private static $locales = array();
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @var Translator
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Get instance
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return Translator
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new self;
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a translation
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user