[Fwd: Re: Proposal for declinations in gettext]



Here's a description of one solution to the problem sent to linux-utf8 
mailing list by <jmaiorana at idirect dot net>.

This approach would also involve many changes in the code (though they 
can also be automated, since they're quite general: inclusion of one 
variable for keeping contexts after each gettext call).

Cheers,
Danilo


<div class="moz-text-flowed" style="font-family: -moz-fixed">> msgid "king"
> msgstr<0> "kralj"
> msgstr<3> "kralja"
> msgstr<5> "kraljem"
>
> msgid "move %s"
> msgstr "premesti %<3>s"
>
> msgid "go with %s"
> msgstr "idi sa %<5>s"


Im curious, how you would implement this?

if I call the following in some preexisting application:
printf( gettext("Please move %s."),  gettext("king") );

the order of operations is :
gettext("king");
gettext("Please move %s.");
printf( %s , %s );

So how would the first gettext("king") know what to return?

I think you could get this to work if there was some sort of context,
which could be used to tie the whole thing together.
such as:

void *ctx = gettext_context("Please move piece.");
printf( gettext(ctx,"Please move %s."),  gettext(ctx,"king") );


The default for context could be NULL, in which case there is no
special behavior, but in cases where exceptional handling is required
you could provide override strings. Context would have to be a mandatory
part of each gettext call...








--
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/linux-utf8/


</div>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]