Skip to content

Commit 884723f

Browse files
Refactor translation key handling logic
1 parent 463ddb5 commit 884723f

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

src/Commands/Parsers/FrontendTranslationsParser.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,9 @@ private function parseFiles($files)
9494
// replace whitespace up to first occurrence of a quote-mark (including)
9595
$translation[1] = preg_replace('/^\s*[\'"`]/U', '', $translation[1]);
9696

97-
if (array_key_exists($translation[0], $allMatches) && $allMatches[$translation[0]] !== $translation[1]) {
98-
99-
$this->error('Duplicitní klíč překladu s rozdílnou hodnotou:');
100-
$this->error("Soubor: $file");
101-
102-
$this->line($translation[0].' = '.$translation[1]);
103-
$this->line($translation[0].' = '.$allMatches[$translation[0]]);
104-
105-
return 1;
106-
} else {
107-
// 'mb_convert_encoding()' prevents 'Malformed UTF-8 characters, possibly incorrectly encoded' error
108-
$allMatches[$translation[0]] = mb_convert_encoding($translation[1], 'UTF-8', 'UTF-8');
97+
if (! array_key_exists($translation[0], $allMatches)) {
98+
// 'mb_convert_encoding()' prevents 'Malformed UTF-8 characters, possibly incorrectly encoded' error
99+
$allMatches[$translation[0]] = mb_convert_encoding($translation[1], 'UTF-8', 'UTF-8');
109100
}
110101
}
111102
}

0 commit comments

Comments
 (0)