Boost logo

Boost :

Subject: Re: [boost] [locale] Formal review of Boost.Locale library starts tomorrow
From: Fabio Fracassi (f.fracassi_at_[hidden])
Date: 2011-04-16 05:32:50


On 15/4/2011 21:33, Artyom wrote:
>> Fabio Wrote:
>

>
> There is no technical limitations to add Qt message catalogs (as they
> very similar to gettext in their concepts), however
> in order to do this I need a documentation of the file format.
>
> (That it what I told last time we discussed it)
>
> It should not be too hard but requires non-negligible amount of work.
>

Yes I understand that, thats why:

>> I wouldn't require such a backend for inclusion, but if/when such a
>> backend gets written I would like it to be included.

So I do not expect you to write such a thing, but if someone did I'd
expect you to integrate it. By the way, can you "guesstimate" how much
work it would take?

>> * it would be nice if boost::locale::format would also
>> understand normal boost::format messages, or a compatible wrapper
>> like boost::locale::compat::format that did the right thing.
>> I think this is important! It would be very unfortunate to have two slightly
>> incompatible facilities.
>>
>
> The major problem is that boost::format has too limited functionality
> for localization. So I can duplicate its functionality but should I?
>
> It is better to make users to understand the difference between two.
>
> Another point is that boost::format throws on almost any error while
> boost::locale::format ignores error (as you don't want a translator
> to crash the program)
>

Maybe. From what I understand from the doku boost::format is a subset of
locale::format, so I'd expect something like this to work:
locale::format("Hello %1%!") % name

Your docs do not say what happens when I do this:
locale::format("Today is {1}.") % date(d)
I'd expect it to work and give the date in some sensible default formatting.

I'd hate if we had to do something like this:

boost::format("Sensor Value (at %1%): %2$.2%") %
(locale::format("{1,date_time}") % date) % value

>> * it would be nice if boost::locale::date_time and boost::date_time interacted
>> nicely, or ideally could be merged
>>
>
> The problem is that they too different.
>
> - boost::locale::date_time is:
> - locale dependent
> - provides non-Gregorian calendars
> - represents the time as single time point
>
> - boost::date_time:: date and ptime has several problems.
>
> See:
> http://cppcms.sourceforge.net/boost_locale/html/appendix.html#why_plain_number
>
> So they can't be really merged.
>

I understand that, thats why I said interact nicely OR merge.

Minimally I'd expect

boost::date_time dt = ...;
locale::format("Today is {1,date}.") % dt
to work.

>> * No boundary analysis in non ICU backends. it would be nice if at least
>> simple cases
>> (only single codepoint chars) would work correctly.
>
> Boundary analysis (or text segmentation) is an algorithm
> defined by the Unicode standard. Its implementation (even
> simple) requires Unicode character database and many other
> things. So I don't really want to include broken or
> partial algorithms especially when they quite complex
> and standard API does not provide them.
>
> I hope once Boost.Unicode will be there it would be simpler.

I understand that. And I am also not particularly fussed about this
point, but it would be nice if e.g. the word iterator worked
correctly, if the input contains only single byte characters.

Regards

Fabio


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk