Jookia
Jookia

Reputation: 6880

C++ Translation Library

Gettext really bugs me with how it doesn't work, and when it does work, it's huge folder hierarchy and unable to simplify it.

Is there a simple translation library for C++, maybe using a hash table out there? OpenTTD has kind of what I want, but I'm not sure..

Upvotes: 0

Views: 2096

Answers (2)

raging-loon
raging-loon

Reputation: 19

Look at Qt Linguist. It is a very simple translation library in which you provide the translations and within the source code you load the translations.

QApplication app;
QTranslator translator;
translator.load("prog_in_fr");
app.installTranslator(translator);

QString message(QObject::tr("Hello, My Friend"));
// If you provided the correct translations,
// this line should print 'Bonjour, Mon Ami'
cout << message << endl;

Note that this is not exact source code and will require modifications.

Upvotes: 0

Jookia
Jookia

Reputation: 6880

After spending months looking for alternatives, I've settled on using Boost.Locale (which uses Gettext).

I've managed to kind of get used to the folder hierarchy, but Boost.Locale has the ability for custom filesystem support, meaning I could reimplement the .mo loader to load from a different structure, or actually use a different format altogether.

Upvotes: 1

Related Questions