Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 2000-08-20 04:34:12


--- In boost_at_[hidden], Karl Nelson <kenelson_at_e...> wrote:

> Streams have a bad tendency to cause pieces by breaking up text.
> This presents a problem for translation as phrases often
> must be translated as one unit with gettext. Further, the use of a
> stream fixes the order of which variables will be displayed which
> makes translation extremely awkward for languages where the order
> does not match that of the original program. As a result most codes
> which are designed for i18n can't use streams.

Indeed code using streams cannot be gettextified (is that the
right word ?)

Instead of inventing a tiny formating language, rewritting
i18n-dependant things in it, just write usual C++, and
translate the _code_ itself.

There is no need to use gettext, just change the code reponsible
for formating and printing messages.

You can do that:
- with conditionnal compilation (for the very old-fashionned :)
- with CVS branchs: one branch = one language (probably
  quite complicated)
- or rather, by moving all the formating code (ie all calls
  to iostream) into a DLL

> ostream.form().

What's that ?

> However, both
> depend on the use of ellipsis which will not accept C++ types.

And we don't want to use the ellipsis anyway.

I have also implemented a class for positionnal args:

http://www.eleves.ens.fr:8080/home/bonnard/Boost/PosStream/

Typicall use is:

  boost::format(cout, "Cannot $1 at $2:$3\nCause: $4\n")
    << "frobnicate"
    << "blaz"
    << showbase << hex << uppercase << 10
    << "no more foobars";

Note that any formatter can be used.

    -- Valentin Bonnard, who doesn't have definite ideas
            about i18n, and who wants to experiment


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