Skip to content

Commit

Permalink
Fixed |t(variable) twig filter in admin
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Nov 3, 2021
1 parent a723bcd commit 8bbf7a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@
* Improved page cloning, added method `Page::initialize()`
2. [](#bugfix)
* Fixed unescaped error messages in JSON error responses
* Fixed `|t(variable)` twig filter in admin

# v1.7.24
## 10/26/2021
Expand Down
6 changes: 6 additions & 0 deletions system/src/Grav/Common/Twig/Extension/GravExtension.php
Expand Up @@ -847,6 +847,12 @@ public function translate(Environment $twig, ...$args)

if (($numargs === 3 && is_array($args[1])) || ($numargs === 2 && !is_array($args[1]))) {
$lang = array_pop($args);
/** @var Language $language */
$language = $this->grav['language'];
if (is_string($lang) && !$language->getLanguageCode($lang)) {
$args[] = $lang;
$lang = null;
}
} elseif ($numargs === 2 && is_array($args[1])) {
$subs = array_pop($args);
$args = array_merge($args, $subs);
Expand Down

0 comments on commit 8bbf7a8

Please sign in to comment.