-
-
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
Added \r to \Gettext\Generators\Po::convertString() #219
Conversation
Great! I miss the |
Yes, I'm working on it, just added it as a first step to solve this
problem.
El mié., 7 ago. 2019 11:25, Oscar Otero <notifications@github.com> escribió:
… Great! I miss the normalizeLineBreak option (or similar name) and some
tests.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#219>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADU3RFLTUAXOHKGLD4IYH3QDKIITANCNFSM4IJ2XD4A>
.
|
@vaites When do you think I can merge this? I'm about to release a new version and would like to include this fix. |
Sorry, I'm very busy now. Release the new version without it... |
After some doubts, here are the changes:
My doubt was where to add the filter with minimum changes. I added first to Generator::toFile() but Generator::toString() doesn't was filtered, so I added the filter() method to Translations class. I didn't added the normalization to Translation::setTranslation() because I think we mustn't fix anything at load, just explicitly when saving. Feel free to rename methods or directly apply it on Translation::setTranslation() if you want. |
Ok, thanks for the contribution. I have some comments:
$translations = Translations::fromPoFile('translations.po', ['normalizeLineBreaks' => true]);
|
Just those were my doubts. I thought about applying the change to the generators but I thought it would be more appropriate to add a generic method (filter) to add there future filters. No problem. Will add it to the generators (I think extractors must not do this) and will make a pull request for each feature. Do you want to be added to all generators, right? |
The problem I see is that translations/translation do not have other methods to fix issues like this (not only line-breaking but also unicode characters, etc). All that stuff is fixed currently in the extractors or generators, so I think is better (IMHO) to be consistent with this, and the translation instances are ready to consume without need to do additional fixes.
This is an option. But why not in the extractors instead generators? Thanks! |
My option was to add only to the generators so as not to affect the loading of existing files at any time. If the user wants to normalize, must set it at save. If you set it only on generators, you can't normalize if you create and save a collection, so this must be added to both extractors and generators. If you don't see any problem with the normalization at loading, why not add this filter to |
Ok, after reading again all issues, I think I understand now the whole problem. What do you think? |
I understand that you only want to escape \r character and revert all other changes, right? I will send you a separated pull request to sortOutput option. |
Yes, sorry for the continuous changes 🙏 |
OK, no problem. In understand this issue is bigger than it seemed at first. |
Well, let's discard this pull request and make a new one forked from the previous commit, instead of reverting all the changes made from there... |
First step to fix #218