Michael Barton wrote: > > If it's done here, each arg should probably be translated > > individually; the caller can always join any arguments which should be > > translated as a whole. Even then, there's no option to have a portion > > which doesn't get translated. > > Like this??? > > proc Gm::errmsg { error args } { > # send error report and optional message (args) to tk_messageBox > set message "" > for arg in $args { > > if { $arg != "" } { > append message "$arg " > } > } > > append message ": " > > tk_messageBox -type ok -icon error -title [G_msg "Error"] \ > -message "$message[G_msg $error]" > uplevel 1 return > > };
I meant to pass each individual arg to G_msg then join the result, i.e. replace: if { $args != ""} { set message [G_msg [join $args]] append message ": " } with: if { $args != ""} { set trans {} foreach msg $args { lappend trans [G_msg $msg] } set message [G_msg [join $trans]] append message ": " } > You are right. A downside of enforcing translation within the function, > rather than relying on it to be done in the original script, is that the > whole thing gets translated. I'm not sure if this is really a problem with > short, optional error messages in reality. The problem occurs if the error message includes variable components, e.g. "unable to open $filename" or "error executing $prog". Only the fixed portions should be translated (otherwise the message catalogue would need an entry for every possible string), then the variable portions should be inserted afterwards. If the variable portions occur in the middle of the string, you would want something like: set template [G_msg {unable to open $filename for reading}] set message [subst -nobackslashes -nocommands $template] Actually, this could be done in the error handling procedure, using "uplevel" to allow "subst" to use variables from the caller. Ultimately, I still think that it's better to have the caller perform the translation. In C code, the _() macro is always applied to the literal string; we don't make G_fatal_error() call _(). Apart from anything else, it makes it easier to identify strings which require translation ("grep G_msg"). -- Glynn Clements <[EMAIL PROTECTED]> _______________________________________________ grass-dev mailing list grass-dev@grass.itc.it http://grass.itc.it/mailman/listinfo/grass-dev