Ren'Py Translation problem [solved]

JBZ

Active Member
Aug 1, 2020
636
1,562
How can I translate the following string into renpy?
Python:
label _("Name Font Size: %s" % (nfs_min + persistent.nfs))
tl file:
Python:
old "Name Font Size: %s"
new "Schriftgröße für Name: %s"

It does not work. Is there a solution for this?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,363
15,280
tl file:
Python:
old "Name Font Size: %s"
new "Schriftgröße für Name: %s"
It does not work.
Isn't there a translate missing somewhere ?

The label being properly wrote to expect a translation, you should find the translation entry in one of the tl files generated by Ren'py.
 

JBZ

Active Member
Aug 1, 2020
636
1,562
Isn't there a translate missing somewhere ?

The label being properly wrote to expect a translation, you should find the translation entry in one of the tl files generated by Ren'py.
The SDK does not generate the translation entry for me. So I wrote the entry myself.
Python:
translate german strings:
    old "Dialogue Font Size: %s"
    new "Schriftgröße für Name: %s"
Without %s it works. The problem is a string with %s.
 

moskyx

Forum Fanatic
Jun 17, 2019
4,005
12,959
The SDK does not generate the translation entry for me. So I wrote the entry myself.
Python:
translate german strings:
    old "Dialogue Font Size: %s"
    new "Schriftgröße für Name: %s"
Without %s it works. The problem is a string with %s.
The "problem" was that the text string is just "Name Font Size: %s"

So the right way to code it in order to be extracted by Ren'Py SDK would be

Python:
label _("Name Font Size: %s") % (nfs_min + persistent.nfs)
This way your old / new statements in the tl file will contain the actual string and it will be translated
 

JBZ

Active Member
Aug 1, 2020
636
1,562
The "problem" was that the text string is just "Name Font Size: %s"

So the right way to code it in order to be extracted by Ren'Py SDK would be

Python:
label _("Name Font Size: %s") % (nfs_min + persistent.nfs)
This way your old / new statements in the tl file will contain the actual string and it will be translated
Perfect!

Muchas gracias :D
 
  • Like
Reactions: moskyx

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,363
15,280
Python:
label _("Name Font Size: %s") % (nfs_min + persistent.nfs)
Wow, good catch.
Haven't noted that the substitution was part of the _() what effectively lead Ren'py to search for "Name Font Size: WHATEVER VALUE" in place of "Name Font Size: %s".