Merge branch 'master' of https://github.com/mcNdave/picea
This commit is contained in:
commit
8368551fa7
23 files changed
+369
-199
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user