Programmatic translation of parameters

More
2 weeks 5 days ago #4075 by rwetzold
I have a bit of a hard time finding good examples for translation in custom scripts so any help is highly appreciated. I want to print out a string like

"No position candidates found " + rule.key + " in room " + room.idx + " on floor " + floor.idx

with rule, room and floor being variables inside the current loop. I would now create a term for that ala

"No position candidates found {rule} in room {room} on floor {floor}"

What method do I call from my script to get the correct translated string? LocalizationManager.GetTranslation does not seem to accept parameters directly but always needs some sort of indirection through game objects. How can this ever work for values generated inside the current function or in loops?

Is there a way how I can pass the three values directly? This would be great, ala

LocalizationManager.GetTranslation("NoCandidates", new Dictionary<string, object>()
{
{ "rule", rule.key },
{ "room", room.idx },
{ "floor", floor.idx }
})

Please Log in or Create an account to join the conversation.

Time to create page: 0.231 seconds
Template by JoomlaShine