From 7f6e00c406c696d4c2de71567fdbc9ce523afe2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Dobro=C5=88?= Date: Sun, 19 Jun 2022 11:40:34 +0200 Subject: [PATCH] Add automatic registration of translations --- src/fbt/Transform/FbtTransform/FbtTransform.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/fbt/Transform/FbtTransform/FbtTransform.php b/src/fbt/Transform/FbtTransform/FbtTransform.php index 774c00c..b6eaab7 100644 --- a/src/fbt/Transform/FbtTransform/FbtTransform.php +++ b/src/fbt/Transform/FbtTransform/FbtTransform.php @@ -4,6 +4,7 @@ use fbt\fbt; use fbt\FbtConfig; +use fbt\Runtime\FbtTranslations; use fbt\Runtime\Shared\FbtHooks; use fbt\Transform\FbtTransform\Processors\HTMLFbtProcessor; use fbt\Util\NodeParser; @@ -45,6 +46,11 @@ public static function transform($html): string ]); if (! self::$init) { + $translations = FbtConfig::get('path') . '/translatedFbts.json'; + if (file_exists($translations)) { + FbtTranslations::registerTranslations(json_decode(file_get_contents($translations), true)); + } + FbtHooks::onTerminating(); self::$init = true;