Cannot localize tooltip string in screens - what's wrong?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
unregistered
Newbie
Posts: 17
Joined: Tue Apr 21, 2020 5:18 am
Contact:

Cannot localize tooltip string in screens - what's wrong?

#1 Post by unregistered »

I am using the tooltip function in screens to show tooltips for different textbuttons or hotspots.

For some weird reason, these texts are not localized. For example things like these:

inventory.rpy:

Code: Select all

(...)

textbutton "{image=/images/cursorsicons/icon_inventory.webp}" style "inventory_button" align (.91,.04) tooltip _("Inventory") action [
            Show("inventory_screen"),
            Hide("inventory_button"),            
            ]           
            
(...)
I am using the tooltip-Text with the GetToolTip() function to show it as soon as the button is hovered.

It works fine as it is.

Now, the translation for this is also created and the strings are translated into different languages:


/tl/german/inventory.rpy:

Code: Select all

translate german strings:
(...)
    # game/inventory.rpy:80
    old "Inventory"
    new "Inventar"
(...)
However, Renpy still just pulls the original string from the original inventory.rpy for the tooltip-string and does not substitute with the translation. So instead of "Inventar", it just continues to show "Inventory". It does find the string when extracting and all - it just doesn't use it ingame.

All other strings are pulled and displayed correctly - even from the same file. But all tooltip-strings just stay at the default language.

What's the issue here?

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1035
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Cannot localize tooltip string in screens - what's wrong?

#2 Post by m_from_space »

Assuming you save your GetToolTip() inside the variable "tooltip", the text object that includes the tooltip needs to look like this:

Code: Select all

text "[tooltip!t]"

# or

text tooltip
not

Code: Select all

text "[tooltip]"

unregistered
Newbie
Posts: 17
Joined: Tue Apr 21, 2020 5:18 am
Contact:

Re: Cannot localize tooltip string in screens - what's wrong?

#3 Post by unregistered »

Argh, I actually even know this. :roll:

Thanks for bumping me in the correct direction! This does the trick. :)

Post Reply

Who is online

Users browsing this forum: No registered users