Closed swissspidy closed 2 months ago
If I understood correctly, an empty comment is the same as an empty line, right? So a simpler approach would be:
// Line 31
if ($line === "#") {
$line = "";
}
Does it make sense?
That... also works! Much simpler, thanks. Code updated ✅
Thanks, merged and released in v4.8.12
This resolves an issue that was brought to our attention in https://github.com/wp-cli/i18n-command/issues/393
Turns out that
msgfmt
doesn't like empty lines between translations when merging PO files, and instead adds empty comments.So a file like this:
Gets turned into this:
As per the spec, whitespace between entries is optional. However, Gettext v4 doesn't parse these files correctly when they look like this.
This PR addresses that.
In the WP-CLI i18n command we currently rely on Gettext v4 because of PHP version requirements, so I hope this bugfix gets accepted still.