Fix how Entry#to_h represents Po entries with multiple lines#28
Fix how Entry#to_h represents Po entries with multiple lines#28rod-murphy wants to merge 4 commits intoarashm:masterfrom
Conversation
|
Sorry for late response, I was traveling. I'll have a look this afternoon. |
|
@arashm it's still WIP - the specs are passing but when I try it in my project, it's not working as expected. Multiline comments are being output incorrectly by Trying to get my head around it, but I think fundamentally the way I'm hoping to go back to it tomorrow or early next week, I'll try to reproduce that scenario in a spec. |
0a90086 to
a7cd96f
Compare
a7cd96f to
cecd72c
Compare
|
@arashm this should we resolved now. Let me know if you spot any issues |
|
@arashm sorry to bug you again. Did you get a chance to look at this. I'd love to just bump the version I have rather than point our app at my fork. |
@rod-murphy could you elaborate why this is necessary? That looks like an unnecessary hack to me. |
|
To add to my previous question. Using this test file: Parsing it and using |
|
Thanks for the reply @dfherr.
As I said above, it's to address the issue where the array produced by In my mind, if I can export an Po object as and array of hashes and must import entries by passing a hash (or array of hashes), then this should be reversible? You can see this when you run The resulting hashes are not correctly added to a Po object when |
|
@rod-murphy that doesn't really clear up why I agree that it makes sense that these are reversible, but why adding another syntax to accessing plural msgstr? |
|
I was checking your original issue #27, and as I remember the issue was not being able to parse the header, because the Wouldn't this be sufficient for your case? |
7621538 to
02994f2
Compare
02994f2 to
9aa72ad
Compare
The reason this is necessary is because of how writer methods are defined. i.e. it's not possible to have a method named To better cover all case and make is a little clearer, I've updated the Entry spec to make things a bit clearer with the following test: Essentially, for @arashm your solution doesn't go far enough. If you run the above spec, you can see that in addition to header entries, strings and multiline forms of |
|
Sorry again for the delay, I will hopefully look into it today after work. |
|
Your suggestion seems to change the behavior of |
|
Thanks @arashm and again sorry for the delay coming back to you. Generally your fix will work for the most part (I've added a few comments to your commit), however, when run against's the test hash from Can you help me understand where I'm changing the behaviour of |
|
It's kinda weird that every message in this topic start with an excuse for the delay on responses, but anyway, I'm sorry 😅 I (again) totally forgot about this for a while.
The behaviour change is exactly about your comment here. The current version of You can see |
As described in #27 multi-line po entries did not export in such a was as they could be successfully reimported when
Entry#to_hwas called on each Entry object.The same thing was happening to multi-line comment entries.
I've changed
Entryso that it accepts plural form msgstr entries asmsgstr_ninstance variable and writer methods, but exports these (viato_h) using originalmsgstr[n]notations.Fixes #27