diff --git a/src/fbt/Services/TranslationsGeneratorService.php b/src/fbt/Services/TranslationsGeneratorService.php index 09ab030..41503d1 100644 --- a/src/fbt/Services/TranslationsGeneratorService.php +++ b/src/fbt/Services/TranslationsGeneratorService.php @@ -168,11 +168,14 @@ public function generateTranslations(string $source, $translationsPath, $inputPa $sourceStrings = json_decode(file_get_contents($source), true); $phrases = $sourceStrings['phrases']; - $hashToTexts = array_column($phrases, 'hashToText'); $translations = []; - foreach ($hashToTexts as $hashToTextGroups) { - foreach ($hashToTextGroups as $hash => $text) { + foreach ($phrases as $phrase) { + $metadata = $phrase['jsfbt']['m'] ?? []; + + $tokens = array_column($metadata, "token"); + $types = array_column($metadata, "type"); + foreach ($phrase['hashToText'] as $hash => $text) { $translations[$hash] = [ 'translations' => [ [ @@ -180,8 +183,8 @@ public function generateTranslations(string $source, $translationsPath, $inputPa 'variations' => [], ], ], - 'tokens' => [], - 'types' => [], + 'tokens' => $tokens, + 'types' => array_map("fbt\Transform\FbtTransform\Translate\FbtSiteMetaEntry::getVariationMaskFromType", $types), ]; } }