Fixes #14016: Fixed empty messages marked as unused in PHP and PO sources when extracted with message command when markUnused is false

This commit is contained in:
Alexander Makarov
2017-10-06 22:24:38 +02:00
committed by GitHub
parent 66723d0e74
commit 6bde69aa96
3 changed files with 38 additions and 2 deletions

View File

@ -702,7 +702,7 @@ EOD;
ksort($existingMessages);
foreach ($existingMessages as $message => $translation) {
if (!$removeUnused && !isset($merged[$message]) && !isset($todo[$message])) {
if (!empty($translation) && (!$markUnused || (strncmp($translation, '@@', 2) === 0 && substr_compare($translation, '@@', -2, 2) === 0))) {
if (!$markUnused || (!empty($translation) && (strncmp($translation, '@@', 2) === 0 && substr_compare($translation, '@@', -2, 2) === 0))) {
$todo[$message] = $translation;
} else {
$todo[$message] = '@@' . $translation . '@@';
@ -804,7 +804,7 @@ EOD;
// add obsolete unused messages
foreach ($existingMessages as $message => $translation) {
if (!$removeUnused && !isset($merged[$category . chr(4) . $message]) && !isset($todos[$category . chr(4) . $message])) {
if (!empty($translation) && (!$markUnused || (substr($translation, 0, 2) === '@@' && substr($translation, -2) === '@@'))) {
if (!$markUnused || (!empty($translation) && ((substr($translation, 0, 2) === '@@' && substr($translation, -2) === '@@')))) {
$todos[$category . chr(4) . $message] = $translation;
} else {
$todos[$category . chr(4) . $message] = '@@' . $translation . '@@';