localisation and gettext

Place to get help with not working mods / modding interface.
User avatar
Xecutor
Filter Inserter
Filter Inserter
Posts: 260
Joined: Mon Jun 23, 2014 10:15 am
Contact:

localisation and gettext

Post by Xecutor »

I added messages.cfg into locale/en/ folder.
But when I call game.gettext('msgname') it returns 'MISSING TRANSLATION'.

messages.cfg contains no bracketed sections. Just a bunch of key=value messages.
Names of items and technology with description are localised fine.

What I'm missing?
JamesOFarrell
Filter Inserter
Filter Inserter
Posts: 402
Joined: Fri May 23, 2014 8:54 am
Contact:

Re: localisation and gettext

Post by JamesOFarrell »

There are two locations for locale files. "__mod__/locale/en/en.cfg" is for translation of prototypes. "__mod__/script-locale/en.cfg" is for use with game.gettext().

Relevant section form the wiki:
Wiki wrote:The game will automatically load locales from mod directories (i.e. mods/foo-mod/locale). The locale directory must be in the same format as the regular locale directory (having two letter directories for different languages and then .cfg files inside). The locales are merged into the original ones. The locale for a mod control.lua script can be placed in the script-locale directory (there the format is having a .cfg file for every language).
User avatar
Xecutor
Filter Inserter
Filter Inserter
Posts: 260
Joined: Mon Jun 23, 2014 10:15 am
Contact:

Re: localisation and gettext

Post by Xecutor »

Uh. Thanks. Info on wiki could be a little more verbose. At evening I totally failed to understand what's written :)
Post Reply

Return to “Modding help”