[REBOL] Re: locale
From: petr:krenzelok:trz:cz at: 26-Aug-2002 7:55
Andrew Martin wrote:
>Just thinking out loud.
>
>What about an automatic language translation of Rebol code? With a language
>field set in the header of the script? Like:
>
>Rebol [
> Name: 'Test
> Language: 'English ; Could be Czech, Spanish,
> ]
>
>For example, a Czech person (is there a better phrase?) gets a Rebol script
>written in English, and wants the display in Czech. And so they use a
>English to Czech translator script that uses, say, Babelfish or other online
>resource to translate individual string! values (or individual words within
>the string! value) into Czech. After some minutes searching, I can across
>this URL:
>http://www.mtranslations.cz/scripts/dict/en/query_new.idc?Slovo=Hello&lang=c
>z&dia=on which translates English/Czech words, and can be easily plugged
>into Rebol.
>
>I'm sure that a language translation function could be written that does the
>majority of the work.
>
>Andrew Martin
>ICQ: 26227169 http://valley.150m.com/
>-><-
>
Hello Andrew,
I too thought about header item usage. My thoughts so far are as follows:
1) you need to know somehow, what languages are supported for certain
app, right? (e.g. to fill drop-down menu with selection) so:
get-languages 'app-name (including-path) ... would return something like:
== ["czech" "english" "spanish" "italian" "french"] etc.
2) then there should be some place, to store user selection. Two levels
- system and app. btw - would it be usefull to have system running in
one language as a whole, while having app-xy running in different
language? If not, we only need some place to store language selected.
Imo the right place is to extend system/lolace using 'preferred-language
item or so. RT could add it. If not added, we can place it into user.r
temporarily (or other config file for Link). So, maybe 'language item in
a header is not necessary at all? Isn't one system-wide setting enough?
3) what is also probably needed, is some way of how to invoke language
catalogue? I am trying to think from the script writer perspective. What
should programmer do? e.g.?:
load-locale 'app-name
== app-name-locale: context [ ....]
load-locale: func ['app-name /language language][
either language [
either find get-languages app-name language [load join app-name
[language ".cat"]][none]
][ either find get-languages app-name preferred-language [.....
you get the idea .. :-)
-pekr-