Re: Segmentation fault after translation
- From: Pablo Saratxaga <pablo mandrakesoft com>
- To: gnome-i18n gnome org
- Subject: Re: Segmentation fault after translation
- Date: Tue, 31 Oct 2000 23:42:30 +0100
Kaixo!
On Wed, Nov 01, 2000 at 10:47:57PM +0100, Fatih Demir wrote:
> > I am having trouble with Gnome file manager after
> > translation. After I launch the file manager,
> > everytime I select an item (either with a right mouse
> > click or left mouse click), the application stalls and
> > displays a segmentation fault error message.
>
> i've had the same problems with my Turkish translation;
> it's because of wrong format specifiers. possibly you've
> translated a %s to a %d -- and: kaboom. That's not nice.
>
> Have a try with msgfmt -c YOUR_PO or msgfmt -vv YOUR_PO.
> This should help you, I think.
There may also be another source of problem that is not detected by
msgfmt -c (because it is a problem with Gtk+, not with the translations):
msgid "/File/Open"
msgstr "| Fajl | Open"
That will make your application crash hardly...
Why? In fact the "/foo/bar/aaa/bbb" is parsed into menu branchs by
some Gtk+ widget; of course the same amount of branches must exist in
the translation and in the original; but also, the name of a branch
must be the same in all its occurrencies.
Otherwise, the result may be that, in some circumstances, a non existing
(in the translation) branch is referenced; and NULL pointers aren't good
for programs...
I learned that the hard way with XMMS :)
Another possibility is the use of some formatters that are not standard C
formatters (eg: %s %d etc) ut formatters used by some specific application
and does its own parsing on them (eg numeric and gnomecal use such things;
translating "yyyy-mm-dd" by "jj/mm/aaaa" in French would not work, it must
be translated by "dd/mm/yyyy" (note that this doesn't make gnomecal crash,
jsut display nothing); the hard thing with those errors is that they are
logic errors not reported by msgfmt -c
While I'm at it, a last one:
I often see (genreally in Japanese and Turkish translations) an inversion
of formatters like:
msgid "%s is the thing that do %s"
msgstr "%s is done by %s"
that of course won't work as expected (and if the formaters are of different
nature the program will even crash!).
If you need to change the order of the various %-pieces (because the syntax
of your language requries it), you can do, but you must then *tell* it
to the program; like this:
msgid "%s is the thing that do %s"
msgstr "%2$s is done by %1$s"
All the %-formaters in msgid have a postional order (nature doesn't matter);
if you need to change that order on the msgstr, then you must, for all of them,
insert #$ between the % and the rest of the formatter; with the # being the
position number (1-based) it has in the msgid.
Another example:
msgid "Mr %s gave %d EUR to Mr %s"
msgstr "Mr %3$ received %2$d from Mr %1$s"
(note how even when a formater keeps its order it must be told as long
as at least two have their order altered)
--
Ki ça vos våye bén,
Pablo Saratxaga
http://www.srtxg.easynet.be/ PGP Key available, key ID: 0x8F0E4975
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]