Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2000:
[Freeciv-Dev] Re: [PATCH] I18n of int_to_text() (PR#517)
Home

[Freeciv-Dev] Re: [PATCH] I18n of int_to_text() (PR#517)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jeff Mallatt <jjm@xxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] I18n of int_to_text() (PR#517)
From: gs234@xxxxxxxxx (Gaute (B) Strokkenes)
Date: 22 Aug 2000 22:45:07 +0200

Jeff Mallatt <jjm@xxxxxxxxxxxx> writes:

> This is an update to the previous patch.  It does some
> reorganization mostly to get rid of #ifdefs, and to allow for an
> indefinite length grouping.  Also adds some comments.

[From the diff:]
>  lc_grouping = (*(lc->grouping)) ? lc->grouping : "\3\0";
>  lc_thousands_sep = (*(lc->thousands_sep)) ? lc->thousands_sep : ",";

This is broken.  A priori, a locale doesn't _have_ to use grouping at
all, and I'm willing to bet a substantial amount of money that there
are locales out there that don't.  If the idea is to to cater for the
case where an American has to forgot to set up the environment
properly, it's probably a better idea to check if LC_NUMERIC == "C".

I think that most of the other changes are for the better, though.

I've made an updated patch:

* Checks if LC_NUMERIC == "C" as above.
* Replaces the cached info with apropriate constants if we're
  configured with --disable-nls.  This makes init_nls() a lot cleaner.
* Bomb-proof asserts.
* Even more comments.

It also removes support for negative numbers.  The reasons for this
are:

1) It's hard to do properly.  localeconv()->negative_sign is actually
   LC_MONETARY rather LC_NUMERIC, and there a slew of other members
   that describe how to use it.  Since int_to_text() is not used to
   format monetary amounts (Freeciv uses gold as a universal currency
   anyway) this is bound to break, one way or another.
2) Freeciv does not need to format number anywhere anyway.
   (int_to_text() is only used for populations etc.)

Note that the old int_to_text() did not support negative numbers.

If, on pain of death, support for negative numbers is deemed to be
necessary, I say we take the cheap way out and just prepend "-".

Attachment: i18n-int_to_text-42.diff
Description: patch against current cvs

-- 
Big Gaute (not to be confused with LG)
I will invent "TIDY BOWL"...

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