summaryrefslogtreecommitdiff
path: root/app/Core/Translator.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Core/Translator.php')
-rw-r--r--app/Core/Translator.php34
1 files changed, 31 insertions, 3 deletions
diff --git a/app/Core/Translator.php b/app/Core/Translator.php
index 43e934a9..e3d19692 100644
--- a/app/Core/Translator.php
+++ b/app/Core/Translator.php
@@ -11,14 +11,14 @@ namespace Core;
class Translator
{
/**
- * Locales path
+ * Locale path
*
* @var string
*/
- const PATH = 'app/Locales/';
+ const PATH = 'app/Locale/';
/**
- * Locales
+ * Locale
*
* @static
* @access private
@@ -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);
@@ -181,5 +206,8 @@ class Translator
if (file_exists($filename)) {
self::$locales = require $filename;
}
+ else {
+ self::$locales = array();
+ }
}
}