[REBOL] Re: locale
From: oliva:david:seznam:cz at: 29-Aug-2002 12:11
Hello Andrew,
Monday, August 26, 2002, 7:22:59 AM, you wrote:
AM> Just thinking out loud.
AM> What about an automatic language translation of Rebol code? With a language
AM> field set in the header of the script? Like:
AM> Rebol [
AM> Name: 'Test
AM> Language: 'English ; Could be Czech, Spanish,
AM> ]
AM> For example, a Czech person (is there a better phrase?) gets a Rebol script
AM> written in English, and wants the display in Czech. And so they use a
AM> English to Czech translator script that uses, say, Babelfish or other online
AM> resource to translate individual string! values (or individual words within
AM> the string! value) into Czech. After some minutes searching, I can across
AM> this URL:
AM> http://www.mtranslations.cz/scripts/dict/en/query_new.idc?Slovo=Hello&lang=c
AM> z&dia=on which translates English/Czech words, and can be easily plugged
AM> into Rebol.
:-))) I was working for mtranslations (now moravia-it:) ... I would
like to see them when they recognize that the server log is full of
Other browsers
not just M$IE.... but I think there are better
translators (and Cyphre has somewhere his rebol gui for them)
Anyway, I'm not sure if such a translation will provide good results
(especially czech language has quite complicated grammer)
I was using these two ways to make multilangual scripts:
1. for generating pages
I have:
languages: [cz en]
languageid: 2 ;for english
localized: func [msg /local txt][
msg: append copy [] msg
txt: any [pick msg languageid msg/1]
txt
]
;And then i have one script for both languages with for example:
print localized ["Ahoj" "Hello"]
;or
months: [
["Leden" "Únor" "Březen" "Duben" "Květen" "Červen" "Červenec" "Srpen" "Září" "Říjen"
"Listopad" "Prosinec"]
["January" "February" "March" "April" "May" "June" "July" "August" "September" "October"
"November" "December"]
]
print join localized ["Dnes je " "Today is "] pick localized months now/month
;the advantage of this approach is that I have all data in one file
;and when I'm too lazy to translate something, the default language is
;used
print localized "Tohle jsem neprelozil"
;or to have different content for english users as:
layout localized [
[image %nejaky.jpg]
[text "You are not allowed to see this czech picture"]
]
.......
2. for pure Rebol scripts (used in R-box2)
this was not system solution.... I have for czech and
english different file called: %msgs.cz.inc and %msgs.en.inc
where I have localized function for status bar messages 'do-msg and a block with
localized strings as:
locstr: ["Zpět" "Nová hra" "Ulož hru" "Načti hru" "Skladník se vrací!"]
and in the script I use:
do-msg 'loaded ;-> prints "Hra načtena..." or "Game loaded..." in the statusbar
print locstr/5
The disadvantage of this method is, that it's quite complicated to
see what you are printing while coding it (in the R-box there was not too much
texts but in some large projects it may be an issue)
.......
Using both methods at once may be good approach - in the main script
you may use the localized function and then simply "build" the
language catalogs (the locstr block?) from it using some translating tool
BUT.... why I should translate my scripts to Czech when I don't see
correct czech characters in Rebol:(
I think that rather then playing
with skinning for the new VID or meditating if it's good to have
%local/ directory somewhere, RT should make some other improvements in the
kernel (at least native rich-text and unicode support and I don't mind
if the new View will be 700kB or 1MB large), because they are
only people allowed to do that (we can change VID by yourselfs)