Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: php-gettext/Gettext
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.8.5
Choose a base ref
...
head repository: php-gettext/Gettext
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.8.6
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on Oct 19, 2021

  1. Fix at fixMultiLines

    Fix at fixMultiLines when several lines start with #~ " to keep them in one single line.
    apeleteiro authored Oct 19, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f9832ed View commit details
  2. Merge pull request #274 from apeleteiro/patch-1

    Fix at fixMultiLines
    oscarotero authored Oct 19, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2f96d82 View commit details
  3. updated changelog

    oscarotero committed Oct 19, 2021
    Copy the full SHA
    bbeb8f4 View commit details
Showing with 18 additions and 8 deletions.
  1. +6 −0 CHANGELOG.md
  2. +12 −8 src/Extractors/Po.php
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

Previous releases are documented in [github releases](https://github.com/oscarotero/Gettext/releases)

## [4.8.6] - 2021-10-19
### Fixed
- Parse PO files with multiline disabled entries [#274]

## [4.8.5] - 2021-07-13
### Fixed
- Prevent adding the same translator comment to multiple functions [#271]
@@ -170,7 +174,9 @@ Previous releases are documented in [github releases](https://github.com/oscarot
[#261]: https://github.com/oscarotero/Gettext/issues/261
[#266]: https://github.com/oscarotero/Gettext/issues/266
[#271]: https://github.com/oscarotero/Gettext/issues/271
[#274]: https://github.com/oscarotero/Gettext/issues/274

[4.8.6]: https://github.com/oscarotero/Gettext/compare/v4.8.5...v4.8.6
[4.8.5]: https://github.com/oscarotero/Gettext/compare/v4.8.4...v4.8.5
[4.8.4]: https://github.com/oscarotero/Gettext/compare/v4.8.3...v4.8.4
[4.8.3]: https://github.com/oscarotero/Gettext/compare/v4.8.2...v4.8.3
20 changes: 12 additions & 8 deletions src/Extractors/Po.php
Original file line number Diff line number Diff line change
@@ -162,15 +162,19 @@ public static function fromString($string, Translations $translations, array $op
protected static function fixMultiLines($line, array $lines, &$i)
{
for ($j = $i, $t = count($lines); $j < $t; ++$j) {
if (substr($line, -1, 1) == '"'
&& isset($lines[$j + 1])
&& substr(trim($lines[$j + 1]), 0, 1) == '"'
) {
$line = substr($line, 0, -1).substr(trim($lines[$j + 1]), 1);
} else {
$i = $j;
break;
if (substr($line, -1, 1) == '"' && isset($lines[$j + 1])) {
$nextLine = trim($lines[$j + 1]);
if (substr($nextLine, 0, 1) == '"') {
$line = substr($line, 0, -1).substr($nextLine, 1);
continue;
}
if (substr($nextLine, 0, 4) == '#~ "') {
$line = substr($line, 0, -1).substr($nextLine, 4);
continue;
}
}
$i = $j;
break;
}

return $line;