Skip to content

Commit

Permalink
Remove .source_strings.json before collecting
Browse files Browse the repository at this point in the history
  • Loading branch information
richardDobron committed Apr 19, 2023
1 parent 80f1835 commit 9ed58f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/fbt/Runtime/Shared/FbtHooks.php
Expand Up @@ -181,9 +181,7 @@ public static function storePhrases()
$parentIds[$index] = self::savePhrase($phrase, $parentIds[$parentKey] ?? null);
}

if (self::$sourceHashes) {
file_put_contents($file, json_encode(self::$sourceStrings), LOCK_EX);
}
file_put_contents($file, json_encode(self::$sourceStrings), LOCK_EX);

FbtTransform::$childToParent = [];
FbtTransform::$phrases = [];
Expand Down
5 changes: 5 additions & 0 deletions src/fbt/Services/CollectFbtsService.php
Expand Up @@ -57,11 +57,16 @@ public function __construct()
public function collectFromFiles(string $path, string $src, string $fbtCommonPath)
{
$fbtDir = $path . '/';
$file = $fbtDir . '.source_strings.json';

if (! is_dir($fbtDir)) {
mkdir($fbtDir, 0755, true);
}

if (file_exists($file)) {
unlink($file);
}

FbtConfig::set('path', $path);
FbtConfig::set('fbtCommonPath', $fbtCommonPath);

Expand Down

0 comments on commit 9ed58f7

Please sign in to comment.