[Gambas-user] Format$ thousand separator

Benoit Minisini gambas at ...1...
Thu Dec 20 13:22:16 CET 2007


On jeudi 20 décembre 2007, Epíleg wrote:
> En/na Benoit Minisini ha escrit:
> > On mercredi 19 décembre 2007, Epíleg wrote:
> >> En/na Benoit Minisini ha escrit:
> >>> On mercredi 19 décembre 2007, Benoit Minisini wrote:
> >>>> On mercredi 19 décembre 2007, Epíleg wrote:
> >>>>> Hello,
> >>>>>
> >>>>> I do not get the thousand separator whit the «format$» function, some
> >>>>> examples:
> >>>>>
> >>>>>
> >>>>> PRINT Format$(1000000, "$$,#.00")  =>  EUR 1 000 000,00
> >>>>>
> >>>>> PRINT Format$(1000000, "$,#.00")  =>  € 1 000 000,00
> >>>>>
> >>>>> PRINT Format$(1000000, ",#.00")  =>  1000000,00
> >>>>>
> >>>>>
> >>>>> What I'm doing wrong?
> >>>>>
> >>>>> These tests are done in a Ubuntu Gutsy (7.10) with «ca_ES.UTF-8»
> >>>>> locale
> >>>>>
> >>>>> Regards,
> >>>>> Epíleg.
> >>>>
> >>>> Apparently, this is a bug!
> >>>
> >>> The last revision now takes thousand separators into account.
> >>>
> >>> But be careful that in the GNU locales, many languages have thousand
> >>> separators only for currencies.
> >>>
> >>> So, when a locale does not have any thousands separator, a space is
> >>> used, and the value is splitted each three digits. Maybe this is a bad
> >>> idea that will be removed in the future!
> >>>
> >>> Regards,
> >>
> >> Thanks!
> >>
> >> In an Ubuntu 7.10 with locale en_US.UTF-8 and en_GB.UTF-8, the thousand
> >> separator works fine also with numbers, but with locale ca_ES.UTF-8 and
> >> es_ES.UTF-8 do not works with numbers (spaces added). In both cases the
> >> currencies thousand separator works fine.
> >>
> >> Excuse my ignorance but in an Open Office Spread document, format
> >> function works correctly with numbers and currencies in all of above
> >> locale and I don't know why.
> >>
> >> Thanks a lot,
> >> Epíleg.
> >
> > The locale information is stored in /usr/share/locale/XXX where XXX is
> > the contents of the LC_* environment variable.
> >
> > Gambas uses this information through the standard Unix API. If I set my
> > environment to es_ES, then I have no standard thousands separator, and a
> > point for currency thousands separator.
> >
> > Maybe Open Office does not use this information. Maybe it uses it, but
> > patches it as Gambas does.
> >
> > For example, KDE uses its own locale information, in
> > the /usr/share/locale/l10n/xxx/entry.desktop file.
> >
> > Regards,
>
> Thank You for Your answer.
>
> From My absolutely ignorance and understanding that this is a locale
> problem, isn't a solution to use the currency thousand separator in numbers
> when this info is missing?
>
> Regards,
> Epíleg.
>

Yes, but if the locale tells that there is no separators with non-currency 
numbers, maybe it is right? I must know if it is a bug or not to take a 
decision!

-- 
Benoit Minisini




More information about the User mailing list