Follow-up Comment #6, bug #14205 (project freeciv):

There is not any culprit other than the too-small buffer.  MAX_LEN_NAME+8 is
an incorrect byte length since the translated text is not a player name and
has no fixed limit; the buffer is just too small. At 40 bytes it is easily
enough to fit any real player name but that can be just 10-20 characters in
some languages which is not enough. It's a bit of an inconsistency that
MAX_LEN_NAME is used in various places as a byte limit (rather than a
character limit) on leader/city/ruler names, but this hasn't been a problem
so far and is unrelated to this bug report.

Do feel free to improve the spacing; using "correct" spacing leads to a
too-long line so I shortened it.

>From the screenshot, the translated text *is* a bit too long for the column. 
This isn't a bug but does make for a bad interface, and if the translator can
shorten it he should.  Hence the <TRANS> comment.

If we really prefer not to use g_strdup_printf we can instead make the buffer
really really long.  Remember though that utf-8 strings can take up to 4 bytes
per character, that here is no fixed limit on how long any translated text may
be, and that truncation can potentially cause crashes within gtk2 while making
it overlong just makes the interface ugly which the translator can then easily
see and fix.  I prefer the strdup approach for the client.

So in summary, this patch should be all that is needed to fix the problem. 
I'm preparing a similar patch to fix a lot of other places (several i've
noticed will surely trigger this same bug eventually if not fixed).


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to