r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

btiffin
10-Jun-2007
[8277]
How many rebols have written language localization routines?

I'm toggling back and forth between external heaps and in-code strings
I've got a RebGUI widget...


lang-text {en "This is the english" fr "C'est francais" it "Don't 
know any italian"}

meaning a translator will have to get dirty in code edits (or send 
to coder) or use

text (lang "SomekindaKey")

where lang is some func that having read some file, selects the string 
key by lang type...
lang-type being buried somewhere in locale*


How often is a REBOL translator a non-programmer?  I find external 
text to be a pain when
coding.  But...it lets non-coders help with translations.


In particular, I only have about 10 or so screens that could be translated. 
 Ashley's

builtin localization nicely handles all the GUI stuff.  I'm leaning 
toward in-code strings.
[unknown: 9]
10-Jun-2007
[8278]
Qtask using a huge database for all languages...
btiffin
11-Jun-2007
[8279]
On the fly translation?  Or work by coders?  Or a text heap?  :)

I guess I'm just looking for advice, but I'm travelling down the 
in-code multi-language
string path.
Gabriele
11-Jun-2007
[8280x6]
my approach is: preprocess the code to identify values that need 
translations (not only strings, any value can be language-dependent)
so if you have     text "Some string"
you add     text #l "Some string"
and the preprocessor can create a nice .catalog file for you
then, you can use a gui tool to edit .catalog files.
http://www.colellachiara.com/soft/libs/locale.r
btiffin
11-Jun-2007
[8286]
Cool.  Thanks Gabriele.  I'll be relying on Ashley's RebGUI code 
for some of the
localization, but this looks like something to dig into.
Ashley
11-Jun-2007
[8287]
A key consideration is whether you want the translation(s) to be 
static (compile-time) or dynamic (run-time). Advantages and disadvantages 
to both approaches.
btiffin
11-Jun-2007
[8288]
Yeah, I toggle back and forth, but they'll be static this time.  
:)
Rebolek
11-Jun-2007
[8289]
some BIND expert, please, help me:

>> act: [add a b]
== [add a b]
>> for a 1 5 1 [for b 1 5 1 [do act]]
** Script Error: a has no value
** Where: do-body
** Near: add a b

There must be something easier than
>> for a 1 5 1 [for b 1 5 1 [do bind bind act 'a 'b]]
Sunanda
11-Jun-2007
[8290]
Is this simpler and the same effect?
    act: func [a b][add a b]
    for a 1 5 1 [for b 1 5 1 [act a b]]
Rebolek
11-Jun-2007
[8291]
hm, not exactly what I want because this is simplified, I have more 
variables than just 'a and 'b, but still useful.
btiffin
11-Jun-2007
[8292]
May or may not work for your needs

for a 1 5 1 [for b 1 5 1 bind act 'a]
Graham
11-Jun-2007
[8293]
Is there an async https protocol in the offing?
Gabriele
11-Jun-2007
[8294]
mine works with both http and https
Graham
11-Jun-2007
[8295x2]
is this the current release?
or you own unreleased version?
Gabriele
11-Jun-2007
[8297]
same version as used on the detective and published on my site
Graham
11-Jun-2007
[8298]
Ok.
Oldes
12-Jun-2007
[8299x3]
what would be the best way how to legalize urls like this one http://maps.google.com/mapfiles//cb/blue_outlines.png
I mean rebol-file from such a url
hm.. parse t: "a//bb/c" [any [to "/" p1: some "/" p2: (p1: change/part 
p1 "/" p2) :p1] to end] t
Anton
13-Jun-2007
[8302x2]
You mean, to "clean" it, into a legal url ?
http://anton.wildit.net.au/rebol/freezer/simple-clean-path.r
Oldes
13-Jun-2007
[8304x2]
yes... that's what I wanted.. especially to make the local file secure 
as well... (so converting url to local file does not leave the send-box:)
I already had own version, but your is a little bit better as correctly 
handles complete url... my was only for the path
Chris
13-Jun-2007
[8306]
This is one reason I wrote my files:// protocol -- http://www.ross-gill.com/r/sandbox.html
(need to add to the library).
Anton
14-Jun-2007
[8307x2]
we also had a secure-clean-path....
Ah.. secure-clean-path should be in rebol.org already.
Henrik
16-Jun-2007
[8309x4]
do func [a b /c] [either c [a + b][a * b]] 2 3

How do I invoke the refinement?
or perhaps:

f. func [a b /c] [either c [a + b][a * b]] 2 3

do :f 2 3 ; <--- here?
Think I figured it out...
nope, didn't work. I need the function in a composed block:


compose [do (:f/c) 2 3] ; causes error, since arguments are not inside 
the compose parantheses.

But the arguments are not used, so:

compose [do (:f/c 2 3)]


But now the arguments are local to the function. The arguments come 
from a different context, so I can't just compose the get-word'ed 
function with the arguments.


So I'll go back to the first question on how to make a refinement 
on an inline function?
Graham
16-Jun-2007
[8313]
why use the refinement in a throwaway function?
Henrik
16-Jun-2007
[8314x3]
the function is rather complex and must be used many times, so I 
wrote it outside the block.
the block is a database query on a remote machine
and the function helps me to find out whether certain conditions 
for a database entry is true or false
Graham
16-Jun-2007
[8317]
Didn't Maarten use refinements in rugby?
Gabriele
16-Jun-2007
[8318x3]
hmm, since you're composing, why not put a path there?
otherwise... do 'f/c 2 3 should work.
>> f: func [a b /c] [either c [a + b][a * b]]
>> do 'f/c 2 3
== 5
>> do 'f 2 3
== 6
Henrik
16-Jun-2007
[8321]
gabriele, what if the function is local, but must be used remotely 
(security is unimportant right now)
Anton
16-Jun-2007
[8322]
That is a good question, Henrik.
Volker
16-Jun-2007
[8323x3]
what is wrong with an extra assignment?
f:  func [a b /c] [either c [a + b][a * b]]]    f/c 1 2
do (f: func [a b /c] [either c [a + b][a * b]] 'f/c) 2 3
or a wrapper, an 'f-without-c and 'f-with-c.
Henrik
16-Jun-2007
[8326]
volker, can't check right now if that works, but does it pack the 
entire function inside the block?