Hey, 2012/9/18 Offirmo <offirmo....@gmail.com>: > I'm using Wt integrated i18 functions. I'm following exactly the example > given in Wt doc here : > http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WMessageResourceBundle.html > > My resource files is defined like this : > > <?xml version="1.0" encoding="UTF-8" ?> > <messages nplurals="2" plural="n==1 ? 0 : 1"> > > <message id="default.countdown.seconds"> > <plural case="0">{1} seconde</plural> > <plural case="1">{1} secondes</plural> > </message> > > However, when using it with the trn() function : > > Wt::WString test= Wt::WString::trn("default.countdown.seconds", 30); > std::cout << test << std::endl; > SHOULD_EQ("30 secondes", test); > > My test fail, and the cout display is "{1} secondes". > > If I repeat the number with an arg like this : > > Wt::WString test= Wt::WString::trn("default.countdown.seconds", 30).arg(30); > > Then it works. > > I find this disturbing. When I look at the example given in Wt doc, it > would seem obvious that the {1} will be replaced by the given number. > However the trn() call is not provided in the doc. > > So, is this the intended behaviour ?
Yes, this is the intended behaviour. WString::trn() only selects the correct instance of your string and is in this sense a generalization over WString::tr(). In either case you need to use .arg() to bind values to the place holders. I've improved the documentation with an example. Regards, koen ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest