diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-05-24 16:30:40 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-05-24 16:30:40 -0400 |
commit | 03fc8a1bce033cc8334f588f3c95baffa1291b54 (patch) | |
tree | 76f36cc3ecbf165476bae8a6e4f1e4f1340b6ec6 /app/Core | |
parent | eeac2329baab1fdae7cbf6c707ed2ffd8beb4c1b (diff) |
Avoid creating multiple instances of Translator
Diffstat (limited to 'app/Core')
-rw-r--r-- | app/Core/Translator.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/Core/Translator.php b/app/Core/Translator.php index 0f5a77cc..e3d19692 100644 --- a/app/Core/Translator.php +++ b/app/Core/Translator.php @@ -27,6 +27,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 * * $translator->translate('I have %d kids', 5); |