Re: russian i18n

Kristian Kvilekval <[email protected]> Sun, 23 Nov 2003 10:38:38 -0800
Newsgroups gmane.comp.audio.zinf.devel
Message-ID <1069612717.32479.5.camel@krispc>
On Sun, 2003-11-23 at 06:05, Robert Hart wrote:
> On Sun, 2003-11-23 at 10:01, Robert Hart wrote:
> 
> > The alternative would be to concatenate the strings together at runtime.
> > e.g. (very much off the top of my head)
> > 
> >     gchar labeltext[50];
> >     sprintf(labeltext, _("version %s"), BRANDING_VERSION);
> >     textlabel = gtk_label_new(labeltext);
> 
> I suppose it would be more "c++" to do:
> 
>     string labeltext;
>     labeltext=_("version ");
>     labeltext+=BRANDING_VERSION;
>     textlabel = gtk_label_new(labeltext.c_str());
> 
> (Although that kinda presumes the order of the two bits stays the same
> in every language). I suppose you'd want to wrap references to BRANDING
> in _() as well.
> 

This was exactly the reason I suggested we start using boost::format.
You would right the above as:

   boost::format  ver(_("version %1%") % BANDING_VERSION);
   textlabel = gtk_label_new(ver.str().c_str());

The numeric "%1%" specifies which argument to use when using multiple
arguments.




-- 
Kristian G. Kvilekval
email:[email protected] office:(805)893-4276 http://www.cs.ucsb.edu/~kris



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/