So I came up with some idea for my game, but I can't figure out how to make it work.
I have persistent variable to toggle True/False from Preferences menu, that should affect certain translation words and phrases in languages other than English.
I figured how to do it with normal dialogues, but I got stuck at strings to translate.
If someone were thinking about something similar, here's code:
Code: Select all
translate language labelname_code:
if persistent.local_names:
r "Line with persitent value True"
else:
r "Line with persitent value False"
And yes, I assume players might want to change it in mid-game. It's a small cosmetic thing, so I don't want them to force restart game.
Basically I change my character names depending on situation, so I tried wrapping them in __( ) *double underscore* and that works, Ren'Py catches them as separate strings for translation. Now comes the hard part, how to translate them based on my persistent variable?
I tried several combinations like:
Code: Select all
old "Rose"
if persistent.local_names:
new "Róża"
else:
new "Rose"
Code: Select all
if persistent.local_names:
old "Rose"
new "Róża"
else:
old "Rose"
new "Rose"
Is it even possible to do it?
Alternatively I'm considering doing another translation set, like 'polish' and 'polish_localized' and swap between them, but that would increase size of the game a tiny bit, doubling most of the lines (not to mention lots of copy-pasting common lines)... But it will also allow to replace dialogue translations immediately, so it's not that bad.
Or maybe there's some option to reference already translated lines and only add few additional?
Any other possible solutions?
Or should I just give up on toggleable localized names and settle either for English names or localized in translation?