/* localisation 1.0 - 99-09-08 S.Huet */ var defaultlang="english";; typeof tabloc = tab [[S S] r1];; /*fonction de hachage*/ fun hachage(ref)= let ((nth_char ref 0)+(nth_char ref 1))&255 -> x in if x==nil then 0 else x;; fun rebuild(l)= if l==nil then nil else let l->[a b] in if b==nil then a::nil else a::" "::rebuild b;; fun loadloc2(l)= if l==nil then 0 else let l->[[a b] n] in (if (nth_char a 0)!='# then let hachage a -> i in set tabloc.i=[a strcatn rebuild b]::tabloc.i else nil; loadloc2 n);; fun loadloc(file,lang)= set tabloc=mktab 256 nil; let strextr _getpack _checkpack strcatn file::"."::lang::".lang"::nil -> l in if l==nil then loadloc2 strextr _getpack _checkpack strcatn file::"."::defaultlang::".lang"::nil else loadloc2 l;; fun findloc(l,s)= if l==nil then "*" else let l->[[a b] n] in if !strcmp a s then b else findloc n s;; /* fonction de traduction */ fun strloc(s,l)= if l==nil then s else let (strfind "##" s 0) -> i in if i==nil then s else strcat substr s 0 i strcat hd l strloc substr s i+2 strlen s tl l;; /* fonction de traduction */ fun loc(s)= let hachage s -> i in findloc tabloc.i s;; /* fonction de chargement */ fun startloc(file)=loadloc file _getress "DefaultLanguage";;