Re: Internationalization



Hi Sami,

Today at 20:31, Sami Pietila wrote:

> With help from Rich Burridge I have been working to bring arithmetic
> precedence support to Gcalctool. 
>
> Next I am planning to do internationalization in order to make
> localization possible. However, I have following problem. I am using
> flex as a scanner. Localization would require flex to accept localized
> tokens.
>
> For example, I have following rule in flex to accept Tan function:
>
> "tan" {return tTAN;}
>
> This should be internationalized in a way which would allow flex to
> accept localized string instead of "tan".

I don't think it's at all easy to do, and I doubt flex could be made
to handle it.

FWIW, I already said that I think implementation here is going to be
the biggest pain.  Perhaps it would be easier and faster to negotiate
with other translators what function names do they need.  I doubt
we've got too many of those variants, so it might prove to be easier
to simply use something like:

tan|tg|blahblah {return tTAN;}

Of course, it's hard to get the proper info from translators, since
even if translators know their local variants of function names,
they'd need to know which English function names they correspond to.

> I have not found any clue from flex or gettext manual how to do this.
>
> My question is: How scanner generated by flex can be internationalized?

I think the answer is: very difficult.  What comes to my mind is to
have something like grammar.flex.in, and to preprocess that in order
to produce grammar.flex.lang for each language, and to compile them 
one by one, and choose which to load up during runtime based on the
current locale.  This sucks, but I cannot imagine a better approach
right now (which doesn't mean there isn't one).

Cheers,
Danilo



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