Skip to content
Tcl Source Code View Ticket
Login

View Ticket

format ignores locale

Open920053ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 18 years ago
Descriptionplain2004-03-20 13:40:50
Hi,

Problem:

'format' command doesn't respect LC_NUMERIC locale
information, because of this:

tclUnixInit.c:652:setlocale(LC_NUMERIC, "C");

which is sensible as a way of not messing things up
internally with Tcl, but creates some problems if one
needs to output things according to the locale being
used, with, say, the format command, where I noticed
the problem.

The only way I can think of, offhand, to fix it would
be to save the old value, and do setlocale during
'format' or other commands that return results.
davidwplain2004-03-21 00:06:45
Logged In: YES 
user_id=240

On second thought, I'm not really sure you would ever want
it to default to this, but there are definitely cases where
it would be useful - when you are outputting to the screen,
say, when you definitely want to be acting according to the
user's locale.
hobbsplain2004-03-21 02:30:27
Logged In: YES 
user_id=72656

I do not think that the format command should be localized
by default.  You can always add a locale command, but there
are a lot of issues for thread-safety, multiple interps, etc
that have to be taken into account - best by the end developer.
hobbs Ticket [920053ffff]: 2 changes [History diff]2004-03-21 02:30:28
dkfplain2004-03-22 16:10:28
Logged In: YES 
user_id=79902

Arguably, there ought to be a way to apply a particular
locale's formatting rules to a specific format pattern. 
Changing to FRQ.
dkfplain2004-03-22 16:12:36
Logged In: YES 
user_id=79902

Perhaps this is something that should be done in msgcat? 
Anything you're formatting according to locale rules
probably ought to go through a message catalog at the same
time...
dkf Ticket [920053ffff]: 2 changes [History diff]2006-06-30 15:16:44
dkf Ticket [920053ffff]: 2 changes [History diff]2006-06-30 15:17:14
dkf Ticket [920053ffff]: 1 change [History diff]2006-06-30 15:28:28
dkf Ticket [920053ffff]: 1 change [History diff]2009-01-30 21:13:42
Log in (anonymous is fine) to add a comment.