vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.79k stars 278 forks source link

Respect original word wrap (and no wrap), or make it configurable #94

Closed den4b closed 10 years ago

den4b commented 10 years ago

Re-saving *.po files with Poedit, forces all long lines in msgid and msgstr entries to be wrapped.

This creates two problems:

  1. Unnecessary diff in version control.
  2. Tools that automatically generate and update *.po files can accumulate such wrapped changes as fuzzy entries.

Specific example: Localization tools of Lazarus IDE (Free Pascal) automatically generate and update .po files for a project. Produced .po files contain long lines. Editing such *.po files with Poedit wraps long lines, creating issues for future automatic updates by the IDE and diff noise in version control.

Please, either respect the original word wrapping (or no wrapping in this case), or at least make it configurable from within Poedit whether it should or shouldn't wrap long lines.

Because of this issue, we are forced to use Virtaal, instead of preferable Poedit.

P.S. This may be related to an old Ticket 25 - please preserve wordwrap.

vslavik commented 10 years ago

PoEdit

(The name's "Poedit", by the way.)

P.S. This may be related to an old Ticket 25 - please preserve wordwrap.

I'm a bit confused here: if you know the issue is already reported and I am aware of it, why are you intentionally creating a duplicate ticket?

Well, to clarify the situation:

  1. It's not nearly as bad in 1.6, which formats the files with msgcat to use the "standard" formatting used by default by the GNU gettext tools. Users of nonstandard tools that care are relatively few, so it's much better compared to 1.5 already.
  2. If it were trivial to do the best thing, it would already be done. Guess what: it isn't quite as trivial to preserve meaningless formatting like this.
  3. I do plan to have this fixed in 1.7 later this year (unless somebody offers a patch sooner…). 1.5 made this better than 1.4; 1.6 improved upon 1.5 and 1.7 should detect & preserve wrapping. Hopefully, 1.8 will not even touch the lines that you didn't modify, but that's a whole new bunch of complications to deal with in the code.
den4b commented 10 years ago

Please let me explain, I reported it here for 3 reasons: 1) The support page states that this is "the" bug tracker. 2) Old bug tracker displays "This is only a read-only copy of the old bug tracker. See the support page". I assumed it is no longer used. 3) The related issue seems like a reverse of what I am asking.

I understand that preserving the original formatting is not trivial, I am a programmer myself. That is why I suggest an simpler workaround, i.e. make word wrapping optional in program settings.

I am only trying to point out that your excellent tool unfortunately cannot be used by rather large community of Lazarus / Free Pascal developers and translators. It is of course up to you to care or not to, and judging from your response you seem to care more about the camel case.

P.S. Sorry for camel case, I fixed it.

vslavik commented 10 years ago

3) The related issue seems like a reverse of what I am asking.

Not really...

suggest an simpler workaround, i.e. make word wrapping optional in program settings.

Adding yet another option with corresponding UI, testing it, translating the UI, that all has its costs too. I'd rather spend the time doing it properly — but again, different patches for interim solution are welcome.

tool unfortunately cannot be used by rather large community of Lazarus / Free Pascal developers and translators

This is simply not the case at all. You can choose not to care. You can choose to pass the files through msgcat and rewrap them if you do care. You can setup your VCS to diff PO files intelligently. And so on, whatever the other people that do use Poedit with Pascal do.

Yes, this behavior of Poedit is suboptimal and should be fixed, but it's hardly the catastrophe you're making it to be. Well, I suppose unless Lazarus tools are so broken that they cannot read perfectly valid format-conforming PO files, but that would hardly be Poedit's fault, would it? And I sincerely hope that's not the case.

Anyway, once again: the fix is planned for 1.7.

you seem to care more about the camel case

Not at all. Just correcting a misspelling.

den4b commented 10 years ago

Yes, this behavior of Poedit is suboptimal and should be fixed, but it's hardly the catastrophe you're making it to be. Well, I suppose unless Lazarus tools are so broken that they cannot read perfectly valid format-conforming PO files, but that would hardly be Poedit's fault, would it? And I sincerely hope that's not the case.

I think you are missing my point. Lazarus tools generate perfectly fine PO files. Generated PO files do not use word-wrapping. Unfortunately, editing and saving such PO files with Poedit enforces word-wrapping which creates noise even when no changes have been made.

I actually created tools to clean the noise that Poedit creates, but I would rather not have to do it all the time. For this reason I will be using Virtaal, simply because it has no such problem.

Hopefully you can address this issue at some point, and I'll happily start using Poedit again. I would pay for the Pro version if it would help address this issue sooner.

vslavik commented 10 years ago

I think you are missing my point.

I don't think I am. The noisy diff part is clear and nobody argues with it. It is also trivially dealt with using msgcat. But you also vaguely alluded to it creating some unspecified "issues for future automatic updates by the IDE" above and that's the part I was referring to — that is something that I could understand would be a show-stopper if it was something serious.

I take it the only actual issue is the noisy diffs one, then.

I actually created tools to clean the noise that Poedit creates

For future reference, the tool for this is msgcat and its --width and --no-wrap flags. With them, you can trivially massage PO files pre-commit or the generated files after creating them.

den4b commented 10 years ago

Thanks for the hint! Running msgcat --no-wrap after editing resolves the issue.

It would be great if you could incorporate that option into Poedit, but I understand that it's not of high priority.

The other issue that I was referring to is consequential, triggered by changes in word wrap, and it is resolved with the above workaround.

P.S. It caused accumulation of such changes as fuzzy entries, it will need to be addressed separately by Lazarus Team to prevent such issues on both ends.

vslavik commented 10 years ago

It would be great if you could incorporate that option into Poedit

As I said above, the plan is to have this solved in 1.7.

barrystaes commented 10 years ago

FYI - I noticed while saving PO files in Poedit 1.6.6 and 1.6.9 msgstr (on Windows 8.1 64 bit) was split into multiple lines, and in Poedit 1.6.2 (on Windows XP 32 bit) the msgstr entries got appended to one line instead. No time to crosscompare versions now, sorry.

dezlov commented 9 years ago

Just wanted to leave feedback to say that this feature has been working perfectly in recent versions!

Now I am a very happy Pro user. Thank you!

vslavik commented 9 years ago

Just wanted to leave feedback to say that this feature has been working perfectly in recent versions!

Much appreciated — that must be a first ;) For years, there were problems with wrapping, over and over again, and I'm still not happy with Poedit's code for wrapping, but I'm cautiously optimistic myself about the behavior finally being good enough...