Re: [gtkmm] Announce: version 1.0.4 of ucompose.hpp



Very nice! I had made my own substitute function which did similar things, but not as robustly. Also, using %1 and %2 makes it easier for the translators than my %s %s %s

Thanks!
Julian

On 21 Jun 2004, at 16:44, Ole Laursen wrote:

Hi,

I've had reports of mysterious crashes on a Finnish UTF-8 locale,
which upon investigation turned out to be because ucompose.hpp was
using std::ostringstream which is not wide enough to hold the Finnish
thousands separator in UTF-8 (and so Glibmm was being feed invalid
UTF-8).

So I've now converted it to std::wostringstream instead and relased
version 1.0.4 of my string composition library. You can find it here:

  http://www.cs.aau.dk/~olau/compose/


About the string composition library: it is small library (i.e. one
header) which defines a bunch of overloaded functions for allowing
this syntax:

  ucompose("The species '%1' has %2 lives.", animal, lives)

    -> "The species 'cat' has 9 lives."

It exist because the native C++ construct

  std::string lives_str = ...;  // some conversion of int lives

  "The species '" + animal + "' has " + lives_str + " lives."

is tedious, error-prone, difficult to read and impossible to localise
(which means your translators and foreign users will hate you).

--
Ole Laursen
http://www.cs.aau.dk/~olau/
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




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