[fpc-devel] Bug in Gettext?

Klaus Reimer k at ailis.de
Fri Jan 9 15:07:35 CET 2009

Michael Van Canneyt wrote:
> I meant: but based on what does GNU gettext calculates the hash code ?
> Is it on:
> String
> Context+String
> Context+#4+String ?

That's exactly my problem. Lazarus only passes "String" to gettext and
this fails (And the reason is clear). My plan was to change this so if
gettext says "I don't have anything for 'String'" then the
DefaultTranslator asks again but this time also passes the context. But
Context+String and Context+#4+String also does not work so I have no
idea how I can modify DefaultTranslator so it gets the correct answer
from the gettext unit.

My current theory is that the hash algorithms of Free Pascal and msgfmt
are nearly the same but not exactly the same so a simple character like
#4 kills the compatibility.

The GNU gettext documentation only says this: "The hash table contains
indices to the sorted array of strings in the MO file. Conflict
resolution is done by double hashing. The precise hashing algorithm used
is fairly dependent on GNU gettext code, and is not documented here."

This sounds like the algorithm isn't "specified" and therefor may change
in future versions. So maybe it's better if the gettext unit created
its own hash table when the MO file is parsed?

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...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20090109/ba8480ab/attachment.sig>

More information about the fpc-devel mailing list