bug-gettext
[Top][All Lists]
Advanced

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

Re: LC_NUMERIC on macOS


From: Bruno Haible
Subject: Re: LC_NUMERIC on macOS
Date: Sun, 12 Jul 2020 10:24:10 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-179-generic; KDE/5.18.0; x86_64; ; )

Hi Gonzalo,

> One thing I noticed with this work-around is that it does not address 
> LC_NUMERIC.  On the Spanish locale, floating point numbers are written 
> with a comma instead of a period.  Leaving LC_NUMERIC as C locale (as it 
> comes both from the GUI and the terminal) does not fix it.

You could, after calling std::locale::global(std::locale("")), call
  setlocale (LC_ALL, "");
(the overridden setlocale from libintl.h!). This would set the LC_NUMERIC
part of the locale in libc. But this is not the right solution, because

1) It may have no effect on the C++ locale.

> However, Mac 
> Preferences show the numeric values with commas in their floating point 
> counterparts.

2) The preferences panel of macOS allows the user to set the properties
independently of any country. The POSIX concept of locale cannot cope with
that. A properly internationalized macOS app should use the following
properties from [1]:

  * kCFLocaleDecimalSeparator, kCFLocaleGroupingSeparator
    instead of LC_NUMERIC,
  * kCFLocaleCalendarIdentifier instead of LC_TIME,
  * kCFLocaleCollationIdentifier, kCFLocaleCollatorIdentifier
    instead of LC_COLLATE,
  * kCFLocaleCurrencySymbol, kCFLocaleCurrencyCode instead of LC_MONETARY.

Bruno

[1] 
https://developer.apple.com/documentation/corefoundation/cflocale/locale_property_keys?language=objc




reply via email to

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