[SOLVED] How to intentionally display a string in a language other than the current one

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
User avatar
Kaji
Regular
Posts: 87
Joined: Thu Nov 17, 2022 10:17 pm
Github: Kaji01
Discord: Kaji#7767
Contact:

[SOLVED] How to intentionally display a string in a language other than the current one

#1 Post by Kaji »

I'm looking at doing a bilingual story, and for that reason I'd like to be able to have the history view show the original Japanese text alongside (e.g. just above) the selected language. So kind of like the following:

Code: Select all

e_ja "ここで英語と日本語を同時に表している"
e_en "We're displaying English and Japanese here"
Is it possible to force it to pull a specific language's string without changing to the language?
Last edited by Kaji on Tue Nov 22, 2022 8:50 am, edited 1 time in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: How to intentionally display a string in a language other than the current one

#2 Post by Ocelot »

https://www.renpy.org/doc/html/translat ... ate_string
renpy.translate_string(s, language=<renpy.object.Sentinel object at 0x7f4dff319cd0>)
Returns s immediately translated into language. If language is Default, uses the language set in the preferences. Strings enclosed in this function will not be added to the list of translatable strings. Note that the string may be double-translated, if it matches a string translation when it is displayed.
Just make sure to not translate to None language (the default one set when the project is created), because it will be translated back immideately.
< < insert Rick Cook quote here > >

User avatar
Kaji
Regular
Posts: 87
Joined: Thu Nov 17, 2022 10:17 pm
Github: Kaji01
Discord: Kaji#7767
Contact:

Re: How to intentionally display a string in a language other than the current one

#3 Post by Kaji »

Thanks!

User avatar
bonnie_641
Regular
Posts: 133
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A.
Deviantart: rubymoonlily
Contact:

Re: [SOLVED] How to intentionally display a string in a language other than the current one

#4 Post by bonnie_641 »

¿And "multiple"^?

To make 2 or more dialogs appear simultaneously, use "multiple" (if 2, multiple=2; if 3, multiple=3 and so....).

This is an example:

Code: Select all

label start:
	"Alice" "I want to tell you something."
	"Edward" "What?!"
	"Alice" "I love you!"
	
	"They were very embarrassed by the awkward situation."
	
	"Alice" "Whhhhaaaaaatttt?!!!" (multiple=2)
	"Edward" "Whhhhaaaaaatttt?!!!" (multiple=2)
	
	"The end?"
	return
	

I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

User avatar
Kaji
Regular
Posts: 87
Joined: Thu Nov 17, 2022 10:17 pm
Github: Kaji01
Discord: Kaji#7767
Contact:

Re: [SOLVED] How to intentionally display a string in a language other than the current one

#5 Post by Kaji »

bonnie_641 wrote: Sun Nov 27, 2022 8:27 pm ¿And "multiple"^?

To make 2 or more dialogs appear simultaneously, use "multiple" (if 2, multiple=2; if 3, multiple=3 and so....).

This is an example:

Code: Select all

label start:
	"Alice" "I want to tell you something."
	"Edward" "What?!"
	"Alice" "I love you!"
	
	"They were very embarrassed by the awkward situation."
	
	"Alice" "Whhhhaaaaaatttt?!!!" (multiple=2)
	"Edward" "Whhhhaaaaaatttt?!!!" (multiple=2)
	
	"The end?"
	return
	

That's a neat trick! Thanks for sharing!

Post Reply

Who is online

Users browsing this forum: Bing [Bot]