On Thu, Apr 6, 2017 at 1:40 PM, Dave Page <dpage@pgadmin.org> wrote:
On Thu, Apr 6, 2017 at 2:27 AM, Jonas Thelemann <e-mail@jonas-thelemann.de> wrote: > Thanks for committing! :) > >>> i18n-trim.diff >>> >>> Removed two linebreaks to improve translation experience. >> >> Hmm, I've applied that, but expect an ongoing battle between gettext and >> PEP8... >> > Ok, I had to look up what PEP8 is :D > So the only problem was that, with those newlines I removed, the > translatable strings contained many extremely useless whitespaces inserted > by the code indentation. I guess a workaround could be to just remove the > spaces like I've seen somewhere else already: > > ---------- > ----------"""abc \n > def""" > ---------- > > instead of: > > ---------- > ----------"""abc def""" > ---------- > > and: > > ---------- > ----------"""abc \n > ----------def""" > ---------- > > ... where dashes represent whitespaces. > But that is just an idea and something somebody with better Python knowledge > should decide :)
Hmm, yeah. So we really need the messages to be a single string, as the splits may not make sense in other languages, so this won't work:
This will return single string only, python won't add any extra whitespace or new line with this format.
>>> print("Hello " \ ... "How are you")
This will result in extra whitespace:
>>> print("Hello \ ... How are you")
Whilst this will result in an extra line break:
>>> print("""Hello ... How are you""")
I'm beginning to think we have no choice but to ignore PEP8 and not allow strings to wrap except where we want them to. I can't find anything on Google about other alternatives - EDB guys, any suggestions?
>> Can you provide patches for the changes above? > > Yes, I can do that, but not right away. I currently have some other things > to complete in the next few weeks, but I'll try to fit that in.