|
Boost Users : |
Subject: Re: [Boost-users] [locale] Quick questions
From: Artyom Beilis (artyomtnk_at_[hidden])
Date: 2011-11-08 05:29:26
Ok I see thanks...
The answer is following.
GCC implicitly included libintl that defines gettext(char const *)...
So even when you call using loc::gettext it still prefers the ::gettext.
This is unfortunate...
Solutions for you:
1. Always use prefix:
loc::gettext("foo")
2. Use using loc::gettext withing the body of the function you use (i.e. in this case withing main)
3. Use translate - it has little bit different semantics but in general its result automatically casts to std::string
std::cout << translate("foo") << std::endl;
4. Use
#define _(x) boost::locale::gettext(x)
This is BTW the most popular solution all over the community of gettext users.
5. Ugly hack #define gettext(x) boost::locale::gettext(x)
I'll update the documentation.
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.sf.net/
CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/
----- Original Message -----
> From: Jookia <166291_at_[hidden]>
> To: Boost-users_at_[hidden]
> Cc:
> Sent: Tuesday, November 8, 2011 11:45 AM
> Subject: Re: [Boost-users] [locale] Quick questions
>
> I made some kind of limited test case: http://www.mediafire.com/?g5axcnch8q20ixo
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net