[wx-dev] Translations contextualization?

Robert Roebling robert at roebling.de
Sat Sep 2 11:23:48 PDT 2006


Armel Asselin wrote:

> Hello all,
> 
> some times ago, I was confronted to the usual problem:
> "how to have the same english string translated differently with respect to 
> its context?"
> 
> in order to do that, the gettext package tells that the right answer is to 
> add some context, either a prefix or suffix, let's choose a prefix, it has 
> the advantage that the string \0 terminator is ok, so just pointing after 
> the context is cool. in our stuff, i chose to use {context} at the start of 
> the to-translate strings. I did not want to hack in wx code at that time, so 
> it caused me some troubles (when translations catalog cannot load for some 
> reason, i finish with the contexts visible in XRC based stuff).
> 
> so, the question is: would it be interesting to have the context handling 
> directly in wx?

Absolutely, yes.

> 
> using {} seems ok, as probably nobody has strings with these symbols at 
> start. escaping the prefix can be done by simply putting {} at the start of 
> a string by the way.
> basically the code to do the job is just some ++ on the pointers.
> 
> for example: (english => french)
> {town}block => ~quartier
> {building}block => parpaing
> {diffing}block => bloc
> {wood}block => rondin

  Robert





More information about the wx-dev mailing list