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
>>    
>>
>they 
>  
>
>>want to sell to non English speaking areas, the right aproach to 
>>localisation is needed. And no, sorry, - I am not about to edit each 
>>reblet and replace strings in there - forget it - that's not 
>>architecture, that's not a concept - I want to be able to switch
>>    
>>
>between 
>  
>
>>the languages freely ... ;-)
>>    
>>
>
>Yes, me to :)
>But the question is HOW and if we pick some solution can we hope RT will
>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-

>bye, bolek
>
>
>---
>Odchozí zpráva neobsahuje viry.
>Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz).
>Verze: 6.0.381 / Virová báze: 214 - datum vydání: 2.8.2002
> 
>
>  
>



-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to