Tk Source Code

View Ticket
Login
Ticket UUID: 539309
Title: make dependence on msgcat "soft"
Type: RFE Version: None
Submitter: dgp Created on: 2002-04-04 16:28:42
Subsystem: 79. L10N Assigned To: bagnonm
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2002-05-08 12:13:24
Resolution: Accepted Closed By: dgp
    Closed on: 2002-05-08 05:13:24
Description:
Tk 8.4 adds localized widgets.  That's good.

However, this means that Tk depends on the msgcat
package.  In the unusual situation where msgcat
is not installed, Tk refuses to load.  It would
be better for Tk to load and fall back on using
English messages.
User Comments: dgp added on 2002-05-08 12:13:23:
Logged In: YES 
user_id=80530

I cleaned up the namespace management in bgerror.tcl.
That completes this issue.  Closing...

bagnonm added on 2002-05-01 00:46:34:

File Added - 22213: bgerror.tcl

bagnonm added on 2002-05-01 00:46:33:
Logged In: YES 
user_id=187881

Don, I am unable to upload the attached bgerror.tcl, the
server seems to be refusing connections currently. This
version is required to complete the msgcat issue.

bagnonm added on 2002-04-29 23:12:01:
Logged In: YES 
user_id=187881

Done.

bagnonm added on 2002-04-18 16:33:58:
Logged In: YES 
user_id=187881

Ok Don, I'll go by the ::tk::msgcat way. One final point, 
where shall we document that tk internals should not 
call ::msgcat::commands?

dgp added on 2002-04-18 06:56:40:
Logged In: YES 
user_id=80530

Depends on what you mean by "Tk developers".  The folks
actually working on Tk itself, yes they'll have to be in
the habit of calling [mc] instead of [::msgcat::mc].  I
would think that would please them.  Unless they have some
perverted love of the SHIFT key.

If you are talking about users of the Tk package, then
you are incorrect.  If they are localizing their code,
they will do their own [package require msgcat] and will
use it directly themselves, not through the Tk library.
Tk's internal replacements for msgcat when msgcat is not
available are for Tk's internal use only.

Tk should not create nor write in ::msgcat.  This is 
taboo because it does not scale.  If more that one
package tries to implement its "soft" dependencies this
way, they will overwrite each other's efforts.

bagnonm added on 2002-04-17 15:38:37:
Logged In: YES 
user_id=187881

By defining your own ::tk::msgcat, tk developers must be 
aware of this, and never use plain ::msgcat::commands. 
Should any one call ::msgcat::mc directly, and this soft 
dependency will fail.
I understand it may not be the most elegant solution, but 
defining a core msgcat avoids this discipline for the rest 
of tk maintainers. Also, it does not preclude later loading 
of the msgcat package, since it does not "package provide" 
anything.

dgp added on 2002-04-16 23:02:48:

File Added - 21300: mc.patch

Logged In: YES 
user_id=80530

Here's the patch I have in mind.

dgp added on 2002-04-16 21:26:06:
Logged In: YES 
user_id=80530

Thanks for fulfilling the request.

I do think it is a mistake, though, for Tk to be
creating and filling the ::msgcat namespace.  It
would be better for Tk to creat the replacement
commands in its own namespace, perhaps ::tk::msgcat,
and then import from there or from ::msgcat depending
on whether the msgcat package is available.

bagnonm added on 2002-04-16 18:53:11:
Logged In: YES 
user_id=187881

A minimal msgcat is defined in case the package is not
available, with fail-safe versions of the msgcat::mc and
msgcat::mcmax procedures, which happen to be the msgcat 
services used by tk widgets.

bagnonm added on 2002-04-05 04:54:34:
Logged In: YES 
user_id=187881

Yes, this may be the way. Give me this weekend, and I will 
try to play with your approach and maybe with some 
overloading.

dgp added on 2002-04-05 00:28:14:
Logged In: YES 
user_id=80530

Note that the best way to do this is to have Tk import
commands from msgcat into its own namespace and call
the imported commands.

Then when it is determined that msgcat is not available,
Tk can just define its own replacements for the imported
commands.

bagnonm added on 2002-04-05 00:19:11:
Logged In: YES 
user_id=187881

Ok, I take the issue.

Attachments: