[GRASS5] another approach to i18n for tcltkgrass; former one revoked

Alex Shevlakov sixote at yahoo.com
Tue May 21 07:42:40 EDT 2002


--- Glynn Clements <glynn.clements at virgin.net> wrote:
> 
> Alex Shevlakov wrote:
> 
> > makes tcltkgrass slow.
> 
> Are you referring to the startup, or to normal
> operation?
>
I was referring mainly to load time (startup).
This made things slow in overall, though. I used a
make-up file combined of about 100 
:msgcat:mc 'eng_message' 'ru_message' lines. The test
showed slow. This is why I think of not using msgcat.
  
> BTW, is the "msgcat" package written in Tcl, or does
> it use the
> functions from libintl/libc?

This is TCL.(:(

proc msgcat::mc {src args} {
    # Check for the src in each namespace starting
from the local and
    # ending in the global.

    variable msgs
    variable loclist
    variable locale

    set ns [uplevel 1 [list ::namespace current]]
    
    while {$ns != ""} {
        foreach loc $loclist {
            if {[info exists msgs($loc,$ns,$src)]} {
                if {[llength $args] == 0} {
                    return $msgs($loc,$ns,$src)
                } else {
                    return [uplevel 1 \
                            [linsert $args 0 ::format
$msgs($loc,$ns,$src)]]
                }
            }
        }
        set ns [namespace parent $ns]
    }
    # we have not found the translation
    return [uplevel 1 \
            [linsert $args 0 [::namespace origin
mcunknown] $locale $src]]
}

> 
> > This is why using msgcat for the purpose of i18n
> seems to me not a
> > good choice now.
> > 
> > Another method would be to place the translated
> script 'menu.tcl' and
> > modules scripts to src/locale/$LCL/tcltkgrass
> directory and copy them
> > if they are needed to $GISBASE/tcltkgrass.
> 
> That would mean that the locale was fixed at install
> time; it should
> be determined at run time, according to $LANG or
> $LC_MESSAGES.

Please see the locale/Gmakefile. If $LCL is defined at
run-time, it is defined the same for mofiles and
tcltkgrass, i.e., once define both.

--alex

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com



More information about the grass-dev mailing list