Skip to content

Commit

Permalink
Update normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
usox committed Dec 18, 2023
1 parent f74caab commit 6a72265
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class Extractor
public const I18N_NAMESPACE = 'http://xml.zope.org/namespaces/i18n';

/** @var list<ExtractorInterface> */
private array $extractors;
private readonly array $extractors;

/**
* @param list<ExtractorInterface>|null $extractors
Expand Down Expand Up @@ -67,7 +67,7 @@ private function normalize(string $value): string
{
return htmlspecialchars(
trim(
(string) preg_replace(['/\n/', '/\r/', '/\t/'], [' ', ' ', ''], $value)
(string) preg_replace(['/\n/', '/\r/', '/\t/', '/\s\s+/',], [' ', ' ', '', ' ',], $value)
)
);
}
Expand Down
5 changes: 3 additions & 2 deletions src/Writer/PotWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public function write(
fwrite(
$stream,
<<<MSG
msgid "$line"
msgstr "$line"\n\n
msgid "{$line}"
msgstr "{$line}"\n\n
MSG
);
}

$dict[$line] = $line;
}

Expand Down

0 comments on commit 6a72265

Please sign in to comment.