Boost logo

Boost :

From: Karl Nelson (kenelson_at_[hidden])
Date: 2000-08-24 11:13:56


> > Number 2 is almost worse than number 1 in that you constantly
> > have to be syncing changes between the multiple branches. The result
> > it that every time you add a new function which deals with
> > both input and some algorithm you have to resync and adjust for
> > all the languages. Assuming that you are writing a really
> > international program with Germany, English, French, Japanese,
> > and say Hebrew, this means deal with everything 5 times.
>
> I don't know CVS very well so I don't know about difficult it is,
> and I will simply believe what you say.

Well if there is no formatter that means that one branch may have one stream
output one way and on stream output another. So it is basically just
like the #ifdef only you see just one of the #ifdef clauses in
each branch.

> > Number 3 is just a pain in the ass because you must make for total
> > isolation of algorithm and input/output. This is good practice though
> > to the extent of total separation is a bit extreme. You still
> > have the problem of having to sync the functions in the many versions
> > of the shared libraries.
>
> You still have to sync the formating strings in the different
> databases.

Syncing database strings is easier because when you change a
string used by your program it nolonger has a translation. Thus
when you rebuild the database it tells you that you need translations
for these strings. No digging through the code to find out where
they are or why they changed. It is now a matter for a translator
not a coder.

 
> > So if you need to add an extra argument to
> > be displayed that means changing 5 pieces of code.
>
> You still have to change 5 formating strings. I don't understand
> why it is easier.

In the shared library approach if I need to add an argument to

   void print_greetings( string name );

to make it

   void print_greetings( string name ,string date);

I need to track down all the code in 5 places and change
both the print_greatings function and the place that envolves
dealing with the output. With gettext, you only have one
piece of code so changing it changes once, and when you
deal with straighening out the database it gets much simpler.

[...]
> With my proposed solutions (1 to 3), the formating is indeed handled
> in the locale-dependant part.

One code base handling many languages is better than many
code bases for many languages. That is the priciple of
maximum reuse. Since following the approach of not having
a format doesn't really contribute to boost, I don't see
a point in discussing all the ways that i18n can be done without
a format function. There is one method of i18n which uses
format and some people wish to use it so I intend to contribute
a class to assist in that effort.

Please send any further responses privately though I think
there is very little additional to discuss.

--Karl


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