[Locale] Boost.Locale - preliminary code

Hello, I'm working on Boost.Locale project. Source code and some basic examples can be found here: https://cppcms.svn.sourceforge.net/svnroot/cppcms/boost_locale/trunk/ It still lacks of documentation and some features. It is mostly tested under Linux gcc-4.3 and it seems to work under MSVC-9 (however I had less tested it). General description: ==================== Boost.Locale is a library that brings high quality localization facilities in C++ way. It uses `std::locale`, and `std::locale` facets in order to pro- vide localization in transparent and C++ aware way to user. C++ has quite good base for localization via existing C++ locale facets: `std::num_put`, `std::ctype`, `std::collate` etc.. But they are very limited and sometimes buggy by design. The support of localization varies between different operating systems and incompatible between them. On the other hand, there is great, well debugged, high quality, widely used ICU library that gives all of the goodies but, it has very old API that mimics Java behavior, it is completely ignores STL and provides useful API only for UTF-16 encoded text, ignoring other popular Unicode encodings like UTF-8 and UTF-16, or limited national character sets like Latin1. Boost.Locale provides the natural glue between C++ locales framework, iostreams and powerful ICU library in following areas: - Correct case conversion, case folding and normalization (DONE) - Collation including support of 4 Unicode collation levels. (DONE) - Date and time formatting and parsing including support of timezones and calendars other then Gregorian. (DONE) - Number formatting, spelling and parsing (DONE) - Monetary formatting and parsing (DONE) - Powerful message formatting including support plural forms, using GNU catalogs. (DONE) - Character, word, sentence and line-break boundary analysis. (TODO) - Support of 8-bit character sets like Latin1 and UTF-8 encoded text. (DONE) - Support of `char`, `wchar_t` and C++0x `char16_t`, `char32_t` strings and streams. (DONE) ------------------------------------------------------------ FYI, It is still work in progress but 90% of the job is done. Please take a look on it --- especially experts in Windows programming. I would glad if someone explains me the process of submission and what should be done for it. I know that it is not yet Boost ready but it goes fast in this direction. Best, Artyom.

Artyom wrote:
Hello,
I'm working on Boost.Locale project.
Source code and some basic examples can be found here:
https://cppcms.svn.sourceforge.net/svnroot/cppcms/boost_locale/trunk/
It still lacks of documentation and some features.
It needs at least basic documentation if you want others to use and evaluate it.

Artyom wrote:
Your right, now it has quite full documentation.
For the interested, docs are at http://cppcms.sourceforge.net/boost_locale/docs/ I have several times in the past wished for a library with an interface compatible with the std locales, but with the power and correctness of ICU, so I find your library interesting. I just took a quick peek at the docs, and noticed that message translation was based on GNU gettext. IIUC, the gettext library's license is LGPL, and its translation tools are GPL. AINAL, but I'm concerned that this may be incompatible with the Boost License. Can you comment on this? In the same vein, did you consider using the ICU ResourceBundle and MessageFormat capabilities instead? If yes, what motivated your choice of gettext? Thanks, -- Éric Malenfant

Hello,
I just took a quick peek at the docs, and noticed that message translation was based on GNU gettext. IIUC, the gettext library's license is LGPL, and its translation tools are GPL. AINAL, but I'm concerned that this may be incompatible with the Boost License. Can you comment on this?
Yes, fist of take a look on Design Rationale: http://cppcms.sourceforge.net/boost_locale/docs/index.html#design-rationale Section: "Why to use GNU Gettext catalogs for message formatting?" In short: 1. Boost.Locale **does not** use GNU Gettext runtime at all. it reimplements the runtime and solves one of big gettext problems thread-safety with multiple locales. So there is no licensing issue at all. 2. Another issue is support of plural forms that so far is the best and most mature one in Gettext. ICU supports plural forms only starting from release 4.0 and plural forms are hard-coded in the locale definition rather then defind as flexible as in Gettext. 3. ICU still does not allow working directly with XLIFF file formath but rather you should convert XLIFF to ICU resource boundles. 4. Availability of free tools for locaization. So I find GNU Gettext more reliable choise for this purpose, also it is much more widely used, the fact is very important for potential software translators.
In the same vein, did you consider using the ICU ResourceBundle and MessageFormat capabilities instead? If yes, what motivated your choice of gettext?
There is no problem to add support of any kind of dictionaries in future without breaking any API or ABI. It is just a metter of writing code. In fact I would prefer adding support of XLIFF in first place rather then support ICU resource boundles. Best, Artyom

Artyom wrote:
Hello,
I'm working on Boost.Locale project.
Source code and some basic examples can be found here:
https://cppcms.svn.sourceforge.net/svnroot/cppcms/boost_locale/trunk/
Hi, I've read the documentation, and this project looks promising. I ray of light in the dire landscape of C++ internationalization. Unfortunately, I don't have any suitable project to try this out on. Sebastian
participants (4)
-
Artyom
-
Edward Diener
-
Eric MALENFANT
-
Sebastian Redl