Page 1 of 1
how to use translated messages?
Posted: Fri Apr 19, 2013 2:38 pm
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
Re: how to use translated messages?
Posted: Fri Apr 19, 2013 2:46 pm
by kovarex
Are you making campaign or custom scenario?
Re: how to use translated messages?
Posted: Fri Apr 19, 2013 2:59 pm
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.
Re: how to use translated messages?
Posted: Fri Apr 19, 2013 3:02 pm
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.
Re: how to use translated messages?
Posted: Fri Apr 19, 2013 4:04 pm
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.
Re: how to use translated messages?
Posted: Fri Apr 19, 2013 4:38 pm
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)
Re: how to use translated messages?
Posted: Sat Apr 20, 2013 3:18 pm
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
Re: how to use translated messages?
Posted: Sat Apr 20, 2013 5:34 pm
by ficolas
you should document the features while you are making em
Re: how to use translated messages?
Posted: Tue Apr 23, 2013 7:35 pm
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.
Re: how to use translated messages?
Posted: Tue Apr 23, 2013 7:59 pm
by ficolas
that just gives a string back, so it can also be used in buttoms.
Re: how to use translated messages?
Posted: Tue Apr 23, 2013 8:04 pm
by drs9999
hmm, never mind. I guess I made a typo when I tested it earlier.