Reputation: 51
First of all How do i make the following example work (from boost website):
#include <boost/locale.hpp>
#include <iostream>
using namespace std;
using namespace boost::locale;
int main()
{
generator gen;
// Specify location of dictionaries
gen.add_messages_path(".");
gen.add_messages_domain("hello");
// Generate locales and imbue them to iostream
locale::global(gen(""));
cout.imbue(locale());
// Display a message using current system locale
cout << translate("Hello World") << endl;
}
(tried creating an hello.mo file but still didn't work).
Basically what i am trying to do is to be able to cout a string like: "operation", and then according to file1 / file2 it will print the string value under id:operation for that specific file.
how can i do that?
Thanks.
Upvotes: 1
Views: 2157
Reputation: 444
boost translate: po file not work might help.
The most confusing step is:
2. Put the .mo file into the correct file structure, for example if your trying to translate to spanish this would be ./es_ES/LC_MESSAGES/hello.mo
It's a wraper of GNU 'gettext' utilities. The manual is useful too.
Upvotes: 2