Programmatic translation of parameters
4 years 9 months ago #4075
by rwetzold
Programmatic translation of parameters was created 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 }
})
"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.
4 years 8 months ago #4099
by rwetzold
Replied by rwetzold on topic Programmatic translation of parameters
Bump, is there anybody who can help here? This is in my eyes super important for good programmatic translation.
Please Log in or Create an account to join the conversation.
Time to create page: 0.156 seconds