*/
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
*
*/
public static function getCurrentLang()
{
- return self::$l10n->getCurrentLang();
+ return self::getClass(L10nClass::class)->getCurrentLang();
}
/**
*
* 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);
}
/**
*/
public static function popLang()
{
- self::$l10n->popLang();
+ self::getClass(L10nClass::class)->popLang();
}
/**
*
* @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);
}
/**
* @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);
}
/**
*/
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();
}
}