Localised names
Localised names
Is there a way to get localised name of ie. recipe in control.lua?
Re: Localised names
game.player.print method converts the lua name to localised. It is even capable of concatenating those.
They're probably inaccessible other way.
They're probably inaccessible other way.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: Localised names
This sux :/ Its not even helpful for print since i would need it to be dynamic not static :/Adil wrote:game.player.print method converts the lua name to localised. It is even capable of concatenating those.
They're probably inaccessible other way.
Re: Localised names
You didn't actually look at the wiki page, did you?oLaudix wrote: i would need it to be dynamic not static :/
Or is my definition of dynamic different from your?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: Localised names
Its impossible to do:Adil wrote:You didn't actually look at the wiki page, did you?oLaudix wrote: i would need it to be dynamic not static :/
Or is my definition of dynamic different from your?
Code: Select all
for i,ingredient in pairs(recipe.ingredients) do
local a = ingredient.name
game.player.print({"entity-name.a"})
end
Re: Localised names
Well, among those file lines of code are three, which are a part of working mod:
(Even more, in real mod it's concatenation of two localized strings.)
Your code should be like this to work:
Code: Select all
a='entity-name.gun-turret'
game.player.print({a})
game.player.print({"",{a}," is destroyed"})
Your code should be like this to work:
Code: Select all
for i,ingredient in pairs(recipe.ingredients) do
local a = "item-name."..ingredient.name
game.player.print({a})
end
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: Localised names
See? You clearly saw something I didn't. I wont apologise for not knowing everything. I will thank you for the code thought, it works exacly as i need.Adil wrote:Well, among those file lines of code are three, which are a part of working mod:(Even more, in real mod it's concatenation of two localized strings.)Code: Select all
a='entity-name.gun-turret' game.player.print({a}) game.player.print({"",{a}," is destroyed"})
Your code should be like this to work:Code: Select all
for i,ingredient in pairs(recipe.ingredients) do local a = "item-name."..ingredient.name game.player.print({a}) end
I found that
Code: Select all
game.item_prototypes[ingredient.name].localised_name