[Freeciv-Dev] Re: ideas for some i18n problems
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Egbert Hinzen <egbert@xxxxxxxxxx> wrote:
> > (It seems to me once you get to this stage, a more pressing
> > problem is going to be word order, for messages where multiple
> > components are assembled. (The gettext docs had something about
> > this, but I didn't understand it, or at least didn't understand
> > how it could work, in general.))
>
> At most places it isn't a problem:
> If you have sentence like "%s has %d Settler."
> you can change the %places "%2$d Settler are owned by %1$s".
Yeah, that's sort of what the docs I saw said. My confusion was
that for this to work, the printf family of functions would have
to support this, and I had not known of such support. But I now
notice this is explicitly documented for various systems' sprintf;
(eg http://www.freebsd.org/cgi/man.cgi).
So my question is, is such support standard, and/or ubiquitous?
(Though its so useful I guess we use it where necessary anyway,
and bad luck if some old systems can't use NLS support as a result.)
> But AFAIK if you start with s.th. like "%2d: %s of %s." you can not change
> that. (I tried it and it compiles fine and all runs until this message
> should be displayed - then at least the server crashes.
Hmm, following test prog worked fine for me:
#include <stdio.h>
int main(void)
{
printf("%2d: %s of %s\n", (int)42, "foo", "bar");
printf("%2$s: %1$2d of %3$s\n", (int)42, "foo", "bar");
printf("%2d: %3$s of %2$s\n", (int)42, "foo", "bar");
return 0;
}
output:
42: foo of bar
foo: 42 of bar
42: bar of foo
-- David
|
|