]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/L10n.php
Merge pull request #7907 from nupplaphil/task/reduce_app_deps
[friendica.git] / src / Core / L10n.php
index 55991dab418a1ff6ce7e33367943b2398e700533..0b76fc639e18db605ad3e9e27d285ac05ea1bd06 100644 (file)
@@ -4,29 +4,15 @@
  */
 namespace Friendica\Core;
 
+use Friendica\BaseObject;
 use Friendica\Core\L10n\L10n as L10nClass;
 
 /**
  * Provide Language, Translation, and Localization functions to the application
  * Localization can be referred to by the numeronym L10N (as in: "L", followed by ten more letters, and then "N").
  */
-class L10n
+class L10n extends BaseObject
 {
-       /**
-        * @var L10nClass
-        */
-       private static $l10n;
-
-       /**
-        * Initializes the L10n static wrapper with the instance
-        *
-        * @param L10nClass $l10n The l10n class
-        */
-       public static function init(L10nClass $l10n)
-       {
-               self::$l10n = $l10n;
-       }
-
        /**
         * Returns the current language code
         *
@@ -34,7 +20,7 @@ class L10n
         */
        public static function getCurrentLang()
        {
-               return self::$l10n->getCurrentLang();
+               return self::getClass(L10nClass::class)->getCurrentLang();
        }
 
        /**
@@ -45,14 +31,15 @@ class L10n
         *
         * If called repeatedly, it won't save the translation strings again, just load the new ones.
         *
-        * @see   popLang()
-        * @brief Stores the current language strings and load a different language.
         * @param string $lang Language code
+        *
         * @throws \Exception
+        * @see   popLang()
+        * @brief Stores the current language strings and load a different language.
         */
        public static function pushLang($lang)
        {
-               self::$l10n->pushLang($lang);
+               self::getClass(L10nClass::class)->pushLang($lang);
        }
 
        /**
@@ -60,7 +47,7 @@ class L10n
         */
        public static function popLang()
        {
-               self::$l10n->popLang();
+               self::getClass(L10nClass::class)->popLang();
        }
 
        /**
@@ -77,11 +64,12 @@ class L10n
         *
         * @param string $s
         * @param array  $vars Variables to interpolate in the translation string
+        *
         * @return string
         */
        public static function t($s, ...$vars)
        {
-               return self::$l10n->t($s, ...$vars);
+               return self::getClass(L10nClass::class)->t($s, ...$vars);
        }
 
        /**
@@ -100,12 +88,13 @@ class L10n
         * @param string $singular
         * @param string $plural
         * @param int    $count
+        *
         * @return string
         * @throws \Exception
         */
        public static function tt(string $singular, string $plural, int $count)
        {
-               return self::$l10n->tt($singular, $plural, $count);
+               return self::getClass(L10nClass::class)->tt($singular, $plural, $count);
        }
 
        /**
@@ -121,28 +110,42 @@ class L10n
         */
        public static function getAvailableLanguages()
        {
-               return self::$l10n::getAvailableLanguages();
+               return L10nClass::getAvailableLanguages();
        }
 
        /**
         * @brief Translate days and months names.
         *
         * @param string $s String with day or month name.
+        *
         * @return string Translated string.
         */
        public static function getDay($s)
        {
-               return self::$l10n->getDay($s);
+               return self::getClass(L10nClass::class)->getDay($s);
        }
 
        /**
         * @brief Translate short days and months names.
         *
         * @param string $s String with short day or month name.
+        *
         * @return string Translated string.
         */
        public static function getDayShort($s)
        {
-               return self::$l10n->getDayShort($s);
+               return self::getClass(L10nClass::class)->getDayShort($s);
+       }
+
+       /**
+        * Load poke verbs
+        *
+        * @return array index is present tense verb
+        *                 value is array containing past tense verb, translation of present, translation of past
+        * @hook poke_verbs pokes array
+        */
+       public static function getPokeVerbs()
+       {
+               return self::getClass(L10nClass::class)->getPokeVerbs();
        }
 }