[fpc-devel] Bug in Gettext?
k at ailis.de
Fri Jan 9 01:35:05 CET 2009
I have a question regarding the Unit "gettext" which is used to parse a
MO file and to translate texts with this file.
I have writte a Lazarus application which uses the DefaultTranslator
class to translate the application. This translator uses the gettext
Unit of Free Pascal. The problem is that all strings which uses a
"message context" in the PO file are not translated at all. Lazarus
automatically writes message contexts to the PO file when same texts are
used in different parts of the application.
So my first thought was that this is a bug in the DefaultTranslator that
it does not pass the message context to the gettext unit. I was going to
add this to the DefaultTranslator unit but then I noticed that i have no
idea how to translate a text whcih uses a message context with the
So can someone tell me how to do this? According to the GNU gettext
documentation the context is prefixed to the original text separated
with an EOT character (#4). So the "orig" text in my case is this:
'TFORM1.BUTTON1.CAPTION' + #4 + 'Test'
But If I pass this string to the translate method of gettext then this
also returns an empty string because the generated hash code for this
string is not found in the hash table of the MO file.
So how can I translate texts which uses message contexts?
Bye, K <http://www.ailis.de/~k/>
[A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391]
(Finger k at ailis.de to get public key)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 260 bytes
Desc: OpenPGP digital signature
More information about the fpc-devel