[SOLVED] What does "[message!tq]" means in notify screen?

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
sandpie
Newbie
Posts: 18
Joined: Tue Apr 25, 2023 1:43 pm
Contact:

[SOLVED] What does "[message!tq]" means in notify screen?

#1 Post by sandpie »

I was thinking how to extend the notify screen with an image (if provided as argument) and then I noticed (pun not intended :roll: ) this unknown pattern (at least for me). This is also different from what is published here https://www.renpy.org/doc/html/screen_s ... tml#notify

Code: Select all

screen notify(message):

    zorder 100
    style_prefix "notify"

    frame at notify_appear:
        text "[message!tq]"

    timer 3.25 action Hide('notify')

Could someone explain what !tq means please?
I think the value of message is between [ ] because it comes from a python value, am I right?

Thank you :)

p.s. I forgot to add that I am using Ren'Py 8.1.3
Last edited by sandpie on Thu Nov 30, 2023 7:31 pm, edited 1 time in total.

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

Re: What does "[message!tq]" means in notify screen?

#2 Post by m_from_space »

RTFM :) https://www.renpy.org/doc/html/text.html

So !t is making sure that string translations work, when they are found.

As for the other one:
The !q conversion flag ensures that text tags are properly quoted, so that displaying a string will not introduce unwanted formatting constructs.
sandpie wrote: Thu Nov 30, 2023 4:05 pm I think the value of message is between [ ] because it comes from a python value, am I right?
It's stating that the program should please put the value of the variable "message" at this position. In this case it's the one argument of the screen.

sandpie
Newbie
Posts: 18
Joined: Tue Apr 25, 2023 1:43 pm
Contact:

Re: What does "[message!tq]" means in notify screen?

#3 Post by sandpie »

Thank you! :)
it's stating that the program should please put the value of the variable "message" at this position
Can you please elaborate? at which position?

Speaking about the !t flag: I thought I understood that to make the strings translatable we should enclose them between _( and ) and I checked that they are successfully exported.. is there any difference between the two "methods"?

Thank you again

P.s I did look for !tq in TFM but I should have looked for the single tags... :oops:

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

Re: What does "[message!tq]" means in notify screen?

#4 Post by m_from_space »

sandpie wrote: Thu Nov 30, 2023 4:38 pm Thank you! :)
it's stating that the program should please put the value of the variable "message" at this position
Can you please elaborate? at which position?
What do you mean? At the position inside the string, that is enclosed with quotes. In this case the message makes up the whole string. Just read the part about interpolating data in the link I provided.
Speaking about the !t flag: I thought I understood that to make the strings translatable we should enclose them between _( and ) and I checked that they are successfully exported.. is there any difference between the two "methods"?
The function _(...) just marks strings as translatable (you only need it when it's not a dialogue line, so for example strings in screens etc.) That means when you later use "Generate translations" within the Renpy GUI, it will include those strings inside the translation file for you to translate. Just try it and then look inside the translation files within the folder called tl. After you did that, it will automatically translate those enclosed strings when a translation is found.

The tag !t just says that Renpy should *look* for a possible translation of the string that is inside this variable (in this case "message"). Otherwise it wouldn't get translated by default. This is mostly important if you need parts of a string translated. So it will look inside the earlier created translation file and find a possible string translation and then display the translation instead of the original string. Sounds complicated? Yes, but it's actually not, once you use Renpy's translation system. So don't worry about it, if you don't plan to.

Consider this:

Code: Select all

# mark this word as translatable, so it will show up in the translation file
default gender = _("female")

label start:
    # interpolated data doesn't get translated by default, you have to enforce it
    e "Hey, I'm Eileen and I am [gender!t]."
So if you would translate this into say German and didn't include the !t, it would wrongly show:

"Hey, ich bin Eileen und ich bin female." instead of weiblich.

sandpie
Newbie
Posts: 18
Joined: Tue Apr 25, 2023 1:43 pm
Contact:

Re: What does "[message!tq]" means in notify screen?

#5 Post by sandpie »

The function _(...) just marks strings as translatable (you only need it when it's not a dialogue line, so for example strings in screens etc.) That means when you later use "Generate translations" within the Renpy GUI, it will include those strings inside the translation file for you to translate. Just try it and then look inside the translation files within the folder called tl. After you did that, it will automatically translate those enclosed strings when a translation is found.

The tag !t just says that Renpy should *look* for a possible translation of the string that is inside this variable (in this case "message"). Otherwise it wouldn't get translated by default. This is mostly important if you need parts of a string translated. So it will look inside the earlier created translation file and find a possible string translation and then display the translation instead of the original string. Sounds complicated? Yes, but it's actually not, once you use Renpy's translation system. So don't worry about it, if you don't plan to.

Consider this:

Code: Select all

# mark this word as translatable
default gender = _("female")

label start:
e "Hey, I'm Eileen and I am [gender!t]."

So if you would translate this into say German and didn't include the !t, it would wrongly show:

"Hey, ich bin Eileen und ich bin female." instead of weiblich.
This is enlightening thank you! Much better than the explanation on the manual. :D I do plan to use the translation system and some custom classes to handle stuff, so it's better if I learn to stick to !t

At the position inside the string, that is enclosed with quotes
My fault, I always concatenated strings with variables using + therefore I didn't understood your answer. :)

GeraldineRushing
Newbie
Posts: 3
Joined: Mon Oct 30, 2023 4:28 am
Contact:

Re: [SOLVED] What does "[message!tq]" means in notify screen?

#6 Post by GeraldineRushing »

Thanks for answering, I appreciate you and if I face any issue, I will update you.

Post Reply

Who is online

Users browsing this forum: No registered users