Re: [Cppcms-users] Setting context.locale()
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-08-29 03:56:21
|
Actually CppCMS's localization is much more powerful then the localization available in standard C++ library - it uses Boost.Locale - renamed to booster namespace <http://cppcms.sourceforge.net/boost_locale/html/tutorial.html> Now, in order to get information about the current locale you may use following: <http://cppcms.sourceforge.net/boost_locale/html/tutorial.html#4e732ced3463d06de0ca9a15b6153677> Generally: std::locale current_locale = context().locale(); booster::locale::info const &inf = std::use_facet<booster::locale::info>(current_locale); lang = inf.language() // for "my" terr = inf.country(); //for "LC" And so on. Artyom ----- Original Message ---- > From: Julian Pietron <ju...@wh...> > To: cpp...@li... > Sent: Sat, August 28, 2010 10:22:07 PM > Subject: Re: [Cppcms-users] Setting context.locale() > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Am 28.08.2010 21:08, schrieb Julian Pietron: > > Hallo, > > > > context().locale("my_LC.enc"); does not work as I expect it to do. > > I configured the cppcms configuration to contain localization.locales [ > > "en_US.utf8", "de_DE.utf8" ] and am now trying to store the user > > selected language in a cookie and read it back on each request and put > > it to context() by using context().locale(session().get("locale")); > > While the cookie contains the correct locale, a following call to > > context().locale().name(); does not read e.g. "de_DE.utf8", but instead > > reads "*" for default locale. So apparently the requested locale is not > > set on the context(). > > What do I have to do to set the locale for context() successfully? > > > > Thanks, > > Julian > > Used hello_locale example to test a bit around, and I realised, that > locale is set correctly, but the currently set locale is not returned by > context().locale(). Instead, the standard locale is returned ("*") I think. > Or do I have to use another call to get the locale's name like > "de_DE.utf-8"? > > Thanks, > Julian > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.15 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQIcBAEBAgAGBQJMeWHeAAoJENidYKvYQHlQ7hYQAMcThPQR4Ydn4uFPnwmXuxQD > vj2oaNwx3b6WcwSNpy5TJR4V3Baa2/fXd8cjskFUuIbm/mG8dfU4PNwQHFbTSWeu > hQfzXPJp4cvJyJgOcCi2NVlrEZbBdqtxGJEonOf6eKJSkkNq3rwC0BKhyINV3EYF > JQza+kO4KcN/KVM8HhoDlf6ENtgYLaDVIKN5Z8CIghvhcUnRqiBv7GQ0FvHPrcVf > AaVeTIloLo5jTSY4J5oSn6SuNaofuIAH7KCmkUye+/yn8V792oUxq4gwGjNm1WhP > nF9yptfQL4CfX7ix+y5jq5YNUx+kuWiVfS/qAA9CJllL2qtu4eCr3uqepCb+2rgc > dRIPB3p/mmztG+7djPkLHwWIz/dilOevTDkMyjk1HVxC5WNbJRMXwPYtA1F3PJft > f4I0PoqAnL4VTKSH5zHjF+JsFtweZSU2J8pFQOjLJMcRQ6ulHciuLeVs1TW5/zW0 > 7rpUpl/e9HKYsOyDBtXcdxC1SBlIqAD2UeIKFAr2eNSMGta7w3LhtjyEc0pakLUR > Mm0RWKGvCtmDQle+5YECliOEcreWcCMTajwvgeLr4AwUjJegxYiTL+2/6ZMEyiqW > BLGKfxJg4u3Z3AB10h+M8xQ46lQDw25JhVu/Wrwx7jA0ev0wa4jrtAeEKT9dl6iH > dYUvNO8OjTlCMdtkv6P0 > =ywJM > -----END PGP SIGNATURE----- > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |