Re: [Lazarus] Multi-line msgid in PO file

2019-01-31 Thread Maxim Ganetsky via lazarus

31.01.2019 14:01, Henry Vermaak via lazarus пишет:

On Wed, Jan 30, 2019 at 08:19:47PM +0300, Maxim Ganetsky via lazarus wrote:

30.01.2019 20:10, Henry Vermaak via lazarus пишет:

I've had a problem with multi-line translations not working and realised
that an extra '\n' was appended to the last line of the msgid in the PO
file causing the translation lookup to fail.  I'm assuming that this is
a bug, but thought I'd ask here first.


Should be fixed in r60268.

Note that multiline strings seem to be always stored with Unix-style 
linebreaks in MO file, while in form they can have e.g. Windows-style or 
maybe even Mac-style linebreaks. Because of this, these strings should 
be normalized with regards to linebreaks before searching in MO file.


Linebreak at the end of multilined string should be present as per PO 
format examples, most PO editors add it anyway.


Also note, that loading multiline resourcestrings from MO files probably 
won't work in many cases for aforementioned reasons too, because Gettext 
unit does not account for platform-specific lineending changes at all.


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Multi-line msgid in PO file

2019-01-31 Thread Henry Vermaak via lazarus
On Wed, Jan 30, 2019 at 08:19:47PM +0300, Maxim Ganetsky via lazarus wrote:
> 30.01.2019 20:10, Henry Vermaak via lazarus пишет:
> > I've had a problem with multi-line translations not working and realised
> > that an extra '\n' was appended to the last line of the msgid in the PO
> > file causing the translation lookup to fail.  I'm assuming that this is
> > a bug, but thought I'd ask here first.
> 
> Multiline translations are used in Lazarus and seem to work?

That's perhaps because lazarus doesn't use .mo files?

> Please send a test project.

OK, see attached.  Steps to reproduce:

- Build project.

- Run and check hover hint on form, it's in English.

- Edit po/fr.po and remove the "\n" on the last line of the multiline
  hint for both msgid and msgstr.

- Re-create the .mo file:

msgfmt -o locale/fr/LC_MESSAGES/multiline.mo po/fr.po

- Run again and the hint will now be in French(*).

Henry

* Or some approximation thereof :)


multiline.tgz
Description: application/gtar-compressed
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus