public function __construct(private readonly SnippetFileHandler
$snippetFileHandler) { } public function fix(MissingSnippetCollection
$missingSnippetCollection): void
{ foreach ($missingSnippetCollection->
getIterator() as $missingSnippetStruct) { // Replace e.g. en-GB to de-DE and en_GB to de_DE
$newPath =
str_replace( [ $missingSnippetStruct->
getAvailableISO(),
str_replace('-', '_',
$missingSnippetStruct->
getAvailableISO()),
],
[ $missingSnippetStruct->
getMissingForISO(),
str_replace('-', '_',
$missingSnippetStruct->
getMissingForISO()),
],
$missingSnippetStruct->
getFilePath() );
$json =
$this->snippetFileHandler->
openJsonFile($newPath);
$json =
$this->
addTranslationUsingSnippetKey(