Boost logo

Boost Users :

Subject: [Boost-users] [Locale] Getting correct system locale under Mac OS X
From: Orhun Birsoy (orhunbirsoy_at_[hidden])
Date: 2013-11-11 16:28:59


I am using boost 1.55.0.rc2.

I am running 10.8.5 and when I select "Norway (Norwegian Bokmal)" (nb_NO)
as the region, LANG env. variable is undefined, making
boost::locale::generator("") to generate a "C" locale. I can of-course get
the locale identifier from NSLocale (or CFLocale) and initialize the
boost::locale::generator with "nb_NO" which seems to be working, but with
Mavericks things got even more interesting.

It looks like, in 10.9 you can mix and match language with a country anyway
you like i.e. I can select "Norway" as my region and "English" as my
language and again LANG is empty but NSLocale returns "en_NO". But this
time when I use boost::locale::generator("en_NO"),
boost::locale::as::number uses "." (dot) as decimal separator, although
NSLocale reports "," (comma).

1. Can boost::locale handle such combinations (en_NO, en_TR, etc)? (I am
using ICU backend, others are explicitly turned off).
 a. for number formatting?
 b. for messages formatting (translations)? which mo will it pick for en_TR
?
2. How can I 'customize' locale generated by boost::locale to reflect the
changes user might do in system locale settings (i.e. select en_US but
change the decimal symbol)?

Thanks.

-- 
Orhun Birsoy


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net