Avoid creating multiple instances of Translator

This commit is contained in:
Frederic Guillot
2015-05-24 16:30:40 -04:00
parent eeac2329ba
commit 03fc8a1bce
2 changed files with 29 additions and 21 deletions

View File

@@ -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
*