Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser eats leading and trailing " in comments #6

Open
reedy opened this issue Jul 18, 2023 · 0 comments
Open

Parser eats leading and trailing " in comments #6

reedy opened this issue Jul 18, 2023 · 0 comments

Comments

@reedy
Copy link

reedy commented Jul 18, 2023

Given file foo.po

# "Bar" Something about "Foo"
msgid "Foo"
msgstr "Fop"

Running quotes.php over it (which doesn't change anything of the file itself):

<?php

require_once 'vendor/autoload.php';

$parser = new PoParser\Parser();
$parser->read("foo.po");
$parser->write("foo.po");

Results in:

# Bar" Something about "Foo
msgid "Foo"
msgstr "Fop"

And seemingly the trailing newline too...

diff --git a/locale/foo.po b/locale/foo.po
index 26d2324..1a38546 100644
--- a/locale/foo.po
+++ b/locale/foo.po
@@ -1,3 +1,3 @@
-# "Bar" Something about "Foo"
+# Bar" Something about "Foo
 msgid "Foo"
-msgstr "Fop"
+msgstr "Fop"
\ No newline at end of file

All together:

$ cat foo.po 
# "Bar" Something about "Foo"
msgid "Foo"
msgstr "Fop"
$ cat quotes.php 
<?php

require_once 'vendor/autoload.php';

$parser = new PoParser\Parser();
$parser->read("foo.po");
$parser->write("foo.po");
$ php quotes.php 
$ cat foo.po 
# Bar" Something about "Foo
msgid "Foo"
msgstr "Fop"$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant