wesnoth-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Wesnoth-dev] locale-independant number parsing


From: Yann Dirson
Subject: Re: [Wesnoth-dev] locale-independant number parsing
Date: Thu, 10 Feb 2005 00:31:21 +0100
User-agent: Mutt/1.5.6+20040907i

On Mon, Feb 07, 2005 at 10:16:44PM +0100, Guillaume Melquiond wrote:
> Sorry, you have lost me here. An "easy way" to handle what? You didn't
> explain the problem you are trying to solve here, so I can't really
> say if your solution is fine or not.

Uh, sure :)

The problem is, your fix completely disables the locale processing for
everything but messages.  As you noted, that means printing of decimal
numbers will use the US format instead of the locale-based one.

So what do we see ?  We need 2 set of I/O routines, one for
locale-dependant for human-readable stuff, and one for
machine-readable stuff.

Now it does not seem that we have such a thing in any standard.
That's bad.  However, glibc provides us with an extension that can be
used for what we want.

Ok, there are much more places where we need machine-based I/O for
numbers in wesnoth, but that's not a problem.  We can
setlocale(LC_NUMERIC, "POSIX"), and only call strto*_l() with the
selecte locale when there is a number to display in the UI, when these
functions are available.  If not, we just define the ones we used as
aliases to the standard ones, ignoring the extra argument.

Does it make more sense now ?

-- 
Yann Dirson    <address@hidden> |
Debian-related: <address@hidden> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]