-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
Problem with new lines and PO files #218
Comments
Hi, thanks for the detailed description. I'm favor to include What do you think? Do you like to work in a PR? |
Well, I think the best solution is to include |
Sounds good to me. Thanks! |
We found a problem with new lines and PO files possibly related with #192. Here's an example code:
If you open the po file with PoEdit the second translation is not processed and shows as empty (no error thrown) and other tools like PhpStorm shows an error (Msgid keyword expected). If you convert \r to its representation like \t or \n these tools works ok.
In the other hand, if you compile the file to mo with
msgfmt
command there's no error and this library parses it without problems, keeping the\r\n
. This means that gettext doesn't care about the format of line breaks, but it does cause problems with certain tools.I think \r must be added to
Gettext\Generators\Po::convertString()
to propertly scape it but don't know enough about gettext to understand the side effects of this change.There are more options... Should this library unify the format of line breaks to avoid problems with certain tools or at least warn if a string is added using line breaks different from the existing ones? O maybe an option to save to po files?. I'm not sure, because I understand that this library (as gettext does) doesn't care about the contents...
To conclude, gettext uses only \n to detect new lines:
The text was updated successfully, but these errors were encountered: