Hello KroArtem,
KroArtem {l Wrote}:were you using some tutorial for this? If yes, share a link to those tutorial, please
We didn't really use any tutorial AFAIK.
Although we decided to use tinygettext and not gettext their documentation still has some valuable information:
http://www.gnu.org/software/gettext/manual/gettext.htmlKroArtem {l Wrote}:As far as I can judge you're using tinygettext to support .po/.mo files. Is this lib compiled when the game compiles
The lib is indeed bundled with the game and compiled alongside it.
BTW I'm not even sure tinygettext can handle .mo files at all...
KroArtem {l Wrote}:what's the main syntax
For gettext the default syntax is basically
gettext( ... ) for every translatable string.
For tinygettext that will be
dictionaryManager->get_dictionary().translate( ... ).
What most people do is alias
gettext() to
_().
We did the same thing with tinygettext using this code:
- {l Code}: {l Select All Code}
#define _(message) (dictionaryManager!=NULL?dictionaryManager->get_dictionary().translate(message).c_str():std::string(message).c_str())
In our case we have also defined a
_C() method which accepts both a message and a dictionary manager.
We need this for different translation files ( = different dictionarymanagers) for (addon) levelpacks and that's one of the main reasons we chose tinygettext.
Gettext simply doesn't support multiple message catalogs in use at the same time.
KroArtem {l Wrote}:are .po files converted to .mo (looks like .po files are used without converting to .mo while other projects convert these files. That looks a bit strange to me.) etc..
.po files can be converted to .mo, which is the binary version of the message catalogue and uses less disk space.
The reason we don't compile them is, first of all that tinygettext doesn't support .mo files.
But keeping it human readable also has the advantage that one can edit it manually without the need to compile.
And you can easily see what has changed when comparing svn revisions.
If you've got any questions left, feel free to ask.
Also take a look at the code for how we initialize the dictionarymanager and use it.