[Mimersbrunn-tcltk] Re: encodings and fallback
Status: Alpha
Brought to you by:
mindtrader
From: Veronica L. <in...@na...> - 2002-02-28 09:16:58
|
>- Generally type msg strings in UTF-8 and build a mechanism in msgcat that >it uses this encoding for the last argument of mcset (As tags I generally >use symbolic tags and no printable text which makes programming easier >(codepage horror)). > This is actually solved in msgcat 1.2.2 (you can get it from cvs, it's not yet included in any release though. It automatically loads the msg-files in utf-8 encoding. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcl/tcl/library/msgcat/ I would suggest either use the new version or just implement the utf-8 encoding loading yourself, you can see how its done in either the code for msgcat or have a look at i18n-howto at developer exchange http://dev.scriptics.com/doc/howto/i18n.html >But I want to have a fallback to a default string if I do (partial) >translations. This does not work any more. I get the symbolic name as >default translation. > >Wouldn't it possible to define a default fallback language to look up if >the default does not have a translation ? > You should be able to do something like that by using the mcunknown command ::msgcat::mcunknown locale src-string This routine is called by ::msgcat::mc in the case when a translation for src-string is not defined in the current locale. The default action is to return src-string. This procedure can be redefined by the application, for example to log error messages for each unknown string. The ::msgcat::mcunknown procedure is invoked at the same stack context as the call to ::msgcat::mc. The return vaue of ::msgcat::mcunknown is used as the return vaue for the call to ::msgcat::mc. - Veronica Loell |