Translation: How to get the text in original language
Posted: Sun Sep 12, 2021 9:14 am
Hi,
I have the issue of getting the original untranslated game's text from a translated text that is passed to the say function. The problem is as follows. I created a hook to the say function like this:
Now the say function is always called with the translated text if a translation is active. My question is if it is possible to somehow get the text in the original language instead, maybe with some other method/hook.
What I am doing is to trigger a lip synchronized talking animation of the character that is currently saying the text that is passed to the say function. This is working almost perfectly, and I do need the translated text for this because lip animation would be different for different languages. So far, so good.
Additionally, I am playing sound files for any text breadcrump enclosed in "*" symboles passed to the say function, i.e. for any text of format "*<some text>*" I play a file "_<some text>.mp3". This works as long as the text inside the "*" symbols is not translated.
Problem is that the translation is covering everything, including those text enclosed inside the "*" symbols. If I have
the talking animation works fine, but the file _knock.mp3 is not played because instead the translated game is looking for a file _klopf.mp3. I know I can also put the knock file into the tl folder under the translated name, but I would rather have a solution where such noise files would not have to be translated.
This is why I am asking if there is a possibility to get the old text if the new one is passed to the say function. And this should also work for the identifier based translations, not just string translations:
Is there a solution for this, or even a better way?
I have the issue of getting the original untranslated game's text from a translated text that is passed to the say function. The problem is as follows. I created a hook to the say function like this:
Code: Select all
my_old_say = renpy.exports.say
def my_say(who, what, *args, **kwargs):
<do something specific with who, what and the arguments>
return my_old_say(who, what, *args, **kwargs)
renpy.exports.say = my_say
What I am doing is to trigger a lip synchronized talking animation of the character that is currently saying the text that is passed to the say function. This is working almost perfectly, and I do need the translated text for this because lip animation would be different for different languages. So far, so good.
Additionally, I am playing sound files for any text breadcrump enclosed in "*" symboles passed to the say function, i.e. for any text of format "*<some text>*" I play a file "_<some text>.mp3". This works as long as the text inside the "*" symbols is not translated.
Problem is that the translation is covering everything, including those text enclosed inside the "*" symbols. If I have
Code: Select all
old "*knock* *knock* -- Anybody home?"
new "*klopf* *klopf* -- Jemand zuhause?"
This is why I am asking if there is a possibility to get the old text if the new one is passed to the say function. And this should also work for the identifier based translations, not just string translations:
Code: Select all
translate de <label>_<hash>:
player_name"*klopf* *klopf* -- Jemand zuhause?"