[REBOL] Re: coding tricks
From: Steven:White:ci:bloomington:mn:us at: 12-May-2003 12:13
Did you want those mailed to the list or you personally?
Here is one that I DID think of my own, but subsequently discovered
that I did NOT think of first. Someone else, possibly in the library,
has used it also, but I can't remember who, so I can't give credit.
Make a script (sample below) containing words whose values are all the
different bits of text that will appear anywhere in an application.
Write the application (sample below) and "do" the first script to load
all those bits of text.
When coding the application, never hard-code any text. Always use one
of the words that contains the desired text. This includes text on
screens, button text, error messages,...everything you can think of.
Then, if you or anyone else wants your application to be used in
another language, someone has to translate that one file of text values,
and that's it. In fact, considering the nature of REBOL, you should be
able to put a button on a screen that would select and "do" different
language files and switch languages on the fly.
Language file: (This would be called "LANGUAGE.R")
REBOL [
]
B001: "OPEN"
B002: "CLOSE"
B003: "SAVE"
T001: "Welcome to my application"
T002: "Please press a button"
Sample application: (Notice how it "does" LANGUAGE.R)
REBOL [
]
do %LANGUAGE.R
view layout [
below
vh1 T001
text T002
across
button B001
button B002
button B003
]
*** END OF SAMPLES ***
Steven White
City of Bloomington
2215 W Old Shakopee Rd
Bloomington MN 55431-3096
USA
952-563-4882 (voice)
952-563-4672 (fax)
[swhite--ci--bloomington--mn--us]
>>> [gchiu--compkarori--co--nz] 05/10/03 03:39AM >>>
Got a special coding trick or Rebol idiom that you use and
wish to share or document?
http://www.compkarori.com/vanilla/display/coding+tricks
--
Graham
http://www.comkarori.com/vanilla/
Rebol Encyclopaedia Project