how to use translated messages?

Place to get help with not working mods / modding interface.
drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

how to use translated messages?

Post by drs9999 »

I want to use a messagedialog that shows a message in the user-defined language.
So I looked into the campaign levels and used this similar to them:

Code: Select all

game.showmessagedialog(game.gettext("msg_outpostIntro"))
While running it I get a "Calling getText when no Translator available"- Error.

I tried to place the en.cfg language file into several locations. Directly into the locale file and in the en-folder.

So how can I use it? Or am I not able to? If it is possible, what will happen if there is no translation-file for the game-language?

Thx

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: how to use translated messages?

Post by kovarex »

Are you making campaign or custom scenario?

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: how to use translated messages?

Post by ficolas »

I have the same problem, somebody gave me a german translation, so I should translate the script too, and idk how to do it.

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: how to use translated messages?

Post by drs9999 »

Oh sorry forgot to mention that...
I dont want to use it in a campaign nor scenario. I want to use it in a mod. So for example in my blueprintsmod a messagedialog is shown that "asked" the player if he either want to copy or cut a setup. So question is if it is possible to show the message in the user-language. Furthermore it would be intresting to know if it is possible to "translate" custom-buttons.

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: how to use translated messages?

Post by kovarex »

We never tested this function outside of the scope of campaign, so there is probably some bug, we will take a look at that.

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: how to use translated messages?

Post by ficolas »

another problem this would bring is, (idk if it alredy haves a solution) to tabulate the buttoms, what I do is press spacebar, because I tried with tab, but it doesnt work, so it would need to be tabulated in the translation... idk there is an easier way than pressing spacebar (I hope so)

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: how to use translated messages?

Post by slpwnd »

This is implemented already in 0.3.x. The mechanism is the same as in the demo or beta missions. The only difference is the location of locale files. In the scenario directory (beta / demo) they are located in [scenario]/locale/[language].cfg. For the mod control.lua they are located in mods/[mod]/script-locale/[language].cfg. Yet another undocumented feature:D

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: how to use translated messages?

Post by ficolas »

you should document the features while you are making em :)

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: how to use translated messages?

Post by drs9999 »

Thx, that works fine.

And to go one step further, what is about button-captions (and flow-caption/-labels in the future)?

It would be nice if you could implement that as well.

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: how to use translated messages?

Post by ficolas »

that just gives a string back, so it can also be used in buttoms.

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: how to use translated messages?

Post by drs9999 »

hmm, never mind. I guess I made a typo when I tested it earlier.

Post Reply

Return to “Modding help”