Skip to content

Commit 1c0a999

Browse files
committed
apply #296 fix to v5
1 parent 46b053c commit 1c0a999

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Change Log
2-
32
All notable changes to this project will be documented in this file.
43

54
The format is based on [Keep a Changelog](http://keepachangelog.com/)
65
and this project adheres to [Semantic Versioning](http://semver.org/).
76

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

9+
## [5.7.1] - Unreleased
10+
### Fixed
11+
- Parsing of PO files with empty comments instead of empty lines [#296]
12+
1013
## [5.7.0] - 2022-07-27
1114
### Added
1215
- StrictPoLoader, a stricter PO loader more aligned with the syntax of the GNU gettext tooling [#282].
@@ -121,7 +124,9 @@ Previous releases are documented in [github releases](https://github.com/oscarot
121124
[#276]: https://github.com/php-gettext/Gettext/issues/276
122125
[#278]: https://github.com/php-gettext/Gettext/issues/278
123126
[#282]: https://github.com/php-gettext/Gettext/issues/282
127+
[#296]: https://github.com/php-gettext/Gettext/issues/296
124128

129+
[5.7.1]: https://github.com/php-gettext/Gettext/compare/v5.7.0...HEAD
125130
[5.7.0]: https://github.com/php-gettext/Gettext/compare/v5.6.1...v5.7.0
126131
[5.6.1]: https://github.com/php-gettext/Gettext/compare/v5.6.0...v5.6.1
127132
[5.6.0]: https://github.com/php-gettext/Gettext/compare/v5.5.4...v5.6.0

src/Loader/PoLoader.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public function loadString(string $string, Translations $translations = null): T
2323
$line = trim($line);
2424
$nextLine = next($lines);
2525

26+
// Treat empty comments as empty lines https://github.com/php-gettext/Gettext/pull/296
27+
if ($line === "#") {
28+
$line = "";
29+
}
30+
2631
//Multiline
2732
while (substr($line, -1, 1) === '"'
2833
&& $nextLine !== false

tests/assets/translations.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ msgstr "Ovo polje ne može ostati prazno."
5454
#: C:/Users/Me/Documents/foo1.php
5555
msgid "This field cannot be blank."
5656
msgstr "Ovo polje ne može biti prazno."
57-
57+
#
5858
#: attributes/address/composer.php:8 attributes/address/form.php:7
5959
msgid "Field of type: %ss"
6060
msgstr "Polje tipa: %ss"

0 commit comments

Comments
 (0)