Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

simple as that ... Re: Re: locale

 [1/10] from: petr::krenzelok::trz::cz at: 26-Aug-2002 10:44


Boleslav Brezovsky wrote:
>>... just kidding ... I think that they think of many things. But - >>everything is about priorities I think. However - they sell IOS. IF
<<quoted lines omitted: 15>>
>make some use of it or will they come in 3-4 years (maybe less ;) with >their own solution (of course incompatible) ?
Yes, it is always the risk :-) OTOH, as you can see, RT included some community code into latest Core updates. So it is upon us, what becomes widely used. I propose following: REBOL [] preferred-language: "Enlish" locale: context [ set 'compose-cat-name func [app language /local blk][ blk: parse last split-path app "." remove back tail blk append blk join "." [language ".cat"] join first split-path app blk ] set 'get-languages func [app /local available][ available: copy [] foreach file read first split-path app [ if %.cat == suffix? file [append available second head reverse parse file "."] ] either empty? available [none][available] ] set 'load-locale func [app /language lang /local available][ language: either language [lang][preferred-language] either all [ not none? available: get-languages app find available language ] [load compose-cat-name app language][none] ] ] requirements: 1) preferred-language item being set either in config file, or system/options/locale 2) to have catalogues of app-name.language.cat placed into app directory .... 3) the only thing needed is to call: load-locale %/C/rebol/view/app.r ; will load preferred language locale file or load-locale/language %/C/rebol/view/app.r "czech" ; will force requested language .... That's really all, you can assign it to whateve word you want, e.g. msgs: load-locale .... Some issues: - versioning (other functions can be added into object, but imo only load-locale should be used, so e.g. load-locale/language/version .... let's not complicate it further .... could be checked easily, if locale file is an object, it could look like: [ version: 1.2.3 app: "app-name" ; not necessary, if we recognize it from file name itself language: "czeh" ; dtto icon: %czech-flag.jpg menu-item_1: "Otevrit ..." ; open etc ] - someone should clean my script - return issues, naming conventions, path issues etc. - I tried to find out script name to allow only load-locale, or load-locale/language "czech", but if script header doesn't contain file-name, you will not find it in system structure .... well, otoh it is maybe good as it is now, as you can call/load locale strings from outside the app itself - e.g. from translation tool, which could follow and help to translate apps ... What do you think? -pekr-

 [2/10] from: zokie:libero:it at: 28-Aug-2002 12:42

Re: simple as that


Hello Petr On 26-Ago-02, Petr Krenzelok wrote:
> REBOL [] > > preferred-language: "Enlish"
I had done a little modification to your load-locale, added a new function, defined suffix? and created 3 catalog files to make %test.r runnable :) It seems to me work fine, what do you think about? As a temporary solution we may store %locale.r into Rebol root directory, and add a line to run it on every Rebol startup at the end of %user.r Regards -- "Where did you get all those facts!?!" -- Binary/unsupported file stripped by Listar -- -- Type: application/x-zip -- File: locale.zip

 [3/10] from: zokie:libero:it at: 29-Aug-2002 20:31


Hello Francesco On 28-Ago-02, Francesco De Napoli wrote:
> -- Binary/unsupported file stripped by Listar -- > -- Type: application/x-zip > -- File: locale.zip >
Sorry! I don't that attachment are not allowed. If you want ge<t it: http://members.xoom.it/amigazette/rebol/locale.zip Regards -- "Where did you get all those facts!?!"

 [4/10] from: petr:krenzelok:trz:cz at: 29-Aug-2002 21:30


Francesco De Napoli wrote:
>Hello Francesco >On 28-Ago-02, Francesco De Napoli wrote:
<<quoted lines omitted: 7>>
>If you want ge<t it: >http://members.xoom.it/amigazette/rebol/locale.zip
just why are you redefining already existant 'suffix? function? :-) -pekr-

 [5/10] from: anton:lexicon at: 30-Aug-2002 9:03


It's only available in latest betas, so defined for backwards compatibility. -Anton.

 [6/10] from: petr:krenzelok:trz:cz at: 30-Aug-2002 10:36


Francesco De Napoli wrote:
>Hello Francesco >On 28-Ago-02, Francesco De Napoli wrote:
<<quoted lines omitted: 8>>
>http://members.xoom.it/amigazette/rebol/locale.zip >Regards
So, I think it works well enough. most of functions does not to be exposed to global-context. Exposing load-locale using 'set could be enough imo ... One thing to think about is placement, path problem. Is there any way of how to know, what path app.r resides on? I mean - if I will start app.r from remote dir, I want somehow to look for catalogues on the same path. The aim is to remove requirement to pass full path to app.r file .... I am not sure I am clear on my intention, but hope you will understand :-) -pekr-

 [7/10] from: zokie:libero:it at: 31-Aug-2002 9:11


Hello Petr On 30-Ago-02, Petr Krenzelok wrote:
> So, I think it works well enough. most of functions does not to be > exposed to global-context. Exposing load-locale using 'set could be > enough imo ...
I do know nothing before yesterday about Context & Set, I only re-edited your code :) I think so too, only open-catalog and make-catalog, perhaps get-languages and load-locale, should be global.
> One thing to think about is placement, path problem. Is there any way of > how to know, what path app.r resides on? I mean - if I will start app.r > from remote dir, I want somehow to look for catalogues on the same path.
I had a multi-path searching routine, the default pathes are: catalog-multi-path: [%./ %catalog/ %//rebol/view/catalog/] Application maker can add one or more pathes by using add-catalog-path (extra-pathes maybe URL), all extra-pathes are added at the head of block, because programmer knows better of us where he put catalog files ;) We should add a kind of application specific catalog multi path system: multi-path-list: [ app1-multi-path: [%./ %catalog/ %//rebol/view/catalog/] app2-multi-path: [http://www.xyz.com/catalog/ http://www.mirror.net/app1/catalog/ %./ %catalog/ %//rebol/view/catalog/] app3-multi-path: [%./ %catalog/ %//rebol/view/catalog/] ] catalog-multi-path: select multi-path-list app-name Now there is a catalog caching system, so if application is run more than one time in the same rebol session there is a big speedup or if its catalog was read from and URL only first time it is necessary to be connected. Open-catalog has a refinement to flush catalog cache: refresh, useful for developing & debugging.
> The aim is to remove requirement to pass full path to app.r file .... I > am not sure I am clear on my intention, but hope you will understand :-)
Yep! I'm a very clever guy :P But I don't know how to retrive this kind of information :( There is a newest version at: http://members.xoom.it/amigazette/rebol/locale.zip Regards -- "Where did you get all those facts!?!"

 [8/10] from: g:santilli:tiscalinet:it at: 31-Aug-2002 16:50


Hi Francesco, On Saturday, August 31, 2002, 9:11:16 AM, you wrote:
>> The aim is to remove requirement to pass full path to app.r file .... I >> am not sure I am clear on my intention, but hope you will understand :-)
FDN> Yep! I'm a very clever guy :P But I don't know how to retrive this kind of FDN> information :( Hmm... are you talking about SYSTEM/SCRIPT/PATH? Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

 [9/10] from: zokie:libero:it at: 1-Sep-2002 8:16


Hello Gabriele On 31-Ago-02, Gabriele Santilli wrote:
>> Yep! I'm a very clever guy :P But I don't know how to retrive this >> information :( > > Hmm... are you talking about SYSTEM/SCRIPT/PATH?
It seems to me pretty good, even if it does not work as we wish with Amiga's Logical Device (assignment). I had used this script to test it: REBOL [] probe system/script After a Rebol startup. with "do %project/locale/path-exp.r" I got "path: %/Work/Rebol/View/project/locale/", that is what I want :) but I before make a cahange of directory to a logical device like this: change-dir %/lp/, where LP is the name of Logical Device obtained with: assign lp: Work:Rebol/View/project/locale/ The script report is "path: %/lp/", that is very different from what I want! Question: is it possible to translate this Logical name into a physical one? It may be a silly question, because Logical Device exist only on Amiga Platform and anyway it works to retrive catalog :) Regards -- "Where did you get all those facts!?!"

 [10/10] from: anton:lexicon at: 3-Sep-2002 4:05


What is returned here?: clean-path %/lp/ Anton.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted