This commit is contained in:
mcndave committed 2020-10-06 15:49:12 +00:00
commit 8368551fa7
23 files changed
+369 -199

No files matched your search

+4 -4
View File
@@ -9,7 +9,7 @@ class LanguageExtension implements Extension {
public array $tokens = [ "lang", "_", "language.set" ];
public string $currentLanguage = "";
protected LanguageHandler $languageHandler;
public function __construct(Context $context, LanguageHandler $handler) {
@@ -38,13 +38,13 @@ class LanguageExtension implements Extension {
$context->pushFunction("_", [ $this, 'relativeLang' ]);
$context->pushFunction("lang", [ $this, 'absoluteLang' ]);
}
public function relativeLang(string $key, array $variables = []) : string
public function relativeLang(string $key, array $variables = []) #: array|string
{
return $this->languageHandler->languageFromKey("{$this->currentLanguage}.{$key}", $variables);
}
public function absoluteLang(string $key, array $variables = []) : string
public function absoluteLang(string $key, array $variables = []) #: array|string
{
return $this->languageHandler->languageFromKey($key, $variables);
}