Boost logo

Boost :

Subject: Re: [boost] [Locale] translate() couples key and output character widths
From: Artyom Beilis (artyomtnk_at_[hidden])
Date: 2013-12-20 06:34:04


That was a loooooong and painful discussion during the boost.locale review.

Such a change was asked by the reviewers that wanted to be able to use
wide strings as keys. For example

translate(L"© All Rights Are Reserved")

Where "©" is non-ASCII character.

This change was mostly required to support non-ascii characters in keys.
To be honest I was strongly against the change but finally had to accept it.

See: http://thread.gmane.org/gmane.comp.lib.boost.devel/218543

Also you can search boost lists the locale review comments...

Artyom Beilis
--------------
CppCMS - C++ Web Framework:   http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/

--------------------------------------------
On Fri, 12/20/13, Alexander Lamaison <awl03_at_[hidden]> wrote:

 Subject: [boost] [Locale] translate() couples key and output character widths
 To: boost_at_[hidden]
 Date: Friday, December 20, 2013, 1:01 PM
 
 I've finally gotten round to changing
 from the pre-release version of
 Boost.Locale (v2.92) to the version now in Boost, and I was
 quite
 surprised by one change.  Previously, I could do the
 following:
 
 void function_takes_wide_string(std::wstring message);
 
 function_takes_wide_string(boost::locale::translate("My
 translation key"));
 
 However, with the new version, the key must be passed in as
 a wide string
 if I am to be able to get a wide string out.  This
 means changing
 `translate("blah")` to `translate(L"blah")` throughout.
 
 The change itself is no big deal, but the problem is that it
 feels like
 a change for the worse.  The character width of the key
 is now coupled
 to the character width of the output, when the two are
 separate concepts
 and should be allowed to vary independently.  The old
 class `message`
 coeerced the string to whichever width was required. 
 The new class
 `basic_message<T>` coerces only to
 `basic_string<T>` and, worse than
 that, doesn't provide a method to explicitly convert to a
 different
 width string.
 
 My question, I suppose, is why was this change made? 
 What makes the new
 API better?
 
 Alex
 
 --
 Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
 
 
 _______________________________________________
 Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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