[Freeciv-Dev] Re: I18n problems
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Zbigniew Chyla wrote:
> On Mon, 27 Sep 1999, Jeff Mallatt wrote:
>
> > My only other question is whether or not to make the macro more robust.
> > What happens if _() returns something that doesn't contain a colon?
>
> Similar question: what happens if translator uses "%s" instead of "%d"?
> You can't avoid translator's stupidity ;)
But hopefully format strings are well known and understood
(and I think can be checked for by xgettext etc). Any less
standard mechanism is more likely to have accidents.
> If you really want to be safe:
>
> #define __(s) ( i18n_tmp = strchr(_(s), ':') ? i18n_tmp + 1 : _(s) )
> (using global variable "char *i18n_tmp")
>
> alternatively (calling strchr() twice):
>
> #define __(s) ( strchr(_(s), ':') ? strchr(_(s), ':') + 1 : _(s) )
Well, does it really have to be a macro?
Compared to calling strchr() and/or (possibly) _() multiple times
seems to me it won't loose too much making it a function.
(Still do the _() outside the function though to allow
optimisation for literal strings.)
-- David
|
|