Skip to content

Commit

Permalink
Add automatic registration of translations
Browse files Browse the repository at this point in the history
  • Loading branch information
richardDobron committed Jun 19, 2022
1 parent 1bf06b5 commit 7f6e00c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/fbt/Transform/FbtTransform/FbtTransform.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7f6e00c

Please sign in to comment.