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.
-
neometalero
- Regular
- Posts: 181
- Joined: Sun Oct 23, 2016 3:51 am
- Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Deviantart: neometalero
-
Contact:
#1
Post
by neometalero » Thu Feb 04, 2021 9:58 am
I'm using this code for changing the language on my screen, but it doesn't work when I change the language. Always show the none option. What I'm doing wrong?
Code: Select all
vbox:
if Language(None):
text _("{color=#F313E4}Points:{/color} ") + str(g.points) size 24
text _("{color=#F313E4}Time:{/color} ") + str(g.duration) size 24
else:
text _("{color=#F313E4}Puntos:{/color} ") + str(g.points) size 24
text _("{color=#F313E4}Tiempo:{/color} ") + str(g.duration) size 24
-
_ticlock_
- Veteran
- Posts: 391
- Joined: Mon Oct 26, 2020 5:41 pm
-
Contact:
#2
Post
by _ticlock_ » Thu Feb 04, 2021 2:12 pm
Hi, neometalero,
Your example is not how the RenPy translation system works.
The construction _("") you are using is necessary for the RenPy translation system to recognize that this string should be translated. For your screen you need only:
Code: Select all
vbox:
text _("{color=#F313E4}Points:{/color} ") + str(g.points) size 24
text _("{color=#F313E4}Time:{/color} ") + str(g.duration) size 24
Then you can generate translation files in the RenPy launcher. (Check
doc and this
cookbook for more info and example).
In your generated translation file that is located in
tl/<language>/<name_of_file.rpy> you should have something like:
Code: Select all
# game/script.rpy:<line number>
old "{color=#F313E4}Points:{/color} "
new "{color=#F313E4}Points:{/color} "
# game/script.rpy:<line number>
old "{color=#F313E4}Time:{/color} "
new "{color=#F313E4}Time:{/color} "
old show default language string, and
new string you replace with translated string
-
Jackkel Dragon
- Veteran
- Posts: 269
- Joined: Mon Mar 31, 2014 7:17 pm
- Organization: Nightshade, Team Despair
- itch: jackkel-dragon
- Location: USA
-
Contact:
#3
Post
by Jackkel Dragon » Thu Feb 04, 2021 3:27 pm
Another note with translating displayables (as opposed to dialogue): some displayables only update on the next interaction. This means changing languages while that text is displayed requires rolling back to update the language. Using translation strings should prevent this in most cases, while the original code you have may require rolling back to work.
Main Website
Includes information about and links to many of my current and past projects.
Major Game Projects
[
Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[
Team Despair] Corpse Party D2 series
-
neometalero
- Regular
- Posts: 181
- Joined: Sun Oct 23, 2016 3:51 am
- Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Deviantart: neometalero
-
Contact:
#4
Post
by neometalero » Thu Feb 04, 2021 5:37 pm
_ticlock_ wrote: ↑Thu Feb 04, 2021 2:12 pm
Hi, neometalero,
Your example is not how the RenPy translation system works.
The construction _("") you are using is necessary for the RenPy translation system to recognize that this string should be translated. For your screen you need only:
Code: Select all
vbox:
text _("{color=#F313E4}Points:{/color} ") + str(g.points) size 24
text _("{color=#F313E4}Time:{/color} ") + str(g.duration) size 24
Then you can generate translation files in the RenPy launcher. (Check
doc and this
cookbook for more info and example).
In your generated translation file that is located in
tl/<language>/<name_of_file.rpy> you should have something like:
Code: Select all
# game/script.rpy:<line number>
old "{color=#F313E4}Points:{/color} "
new "{color=#F313E4}Points:{/color} "
# game/script.rpy:<line number>
old "{color=#F313E4}Time:{/color} "
new "{color=#F313E4}Time:{/color} "
old show default language string, and
new string you replace with translated string
Renpy didnt generated translations for those items on the screen, that why I tryied to to it by hand
-
neometalero
- Regular
- Posts: 181
- Joined: Sun Oct 23, 2016 3:51 am
- Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Deviantart: neometalero
-
Contact:
#5
Post
by neometalero » Thu Feb 04, 2021 5:38 pm
Jackkel Dragon wrote: ↑Thu Feb 04, 2021 3:27 pm
Another note with translating displayables (as opposed to dialogue): some displayables only update on the next interaction. This means changing languages while that text is displayed requires rolling back to update the language. Using translation strings should prevent this in most cases, while the original code you have may require rolling back to work.
Tks, I didnt knew that about displayables. Will check if rolling back works.
Users browsing this forum: Google [Bot]