[Solved] File by language

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
DrBreath
Newbie
Posts: 9
Joined: Fri Apr 01, 2022 4:12 pm
Contact:

[Solved] File by language

#1 Post by DrBreath » Wed May 11, 2022 9:00 pm

Hi, As it says in the title I wanted to know if there is a way to make files for each language for example:

english_Hints.rpy

spanish_Hints.rpy


I ask this because I have already tried with

Code: Select all

_(" ")
and

Code: Select all

__(" ")
(which by the way I know how to use, it just doesn't work).



Thank you in advance
Last edited by DrBreath on Fri May 13, 2022 10:01 pm, edited 1 time in total.

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

Re: File by language

#2 Post by Ocelot » Thu May 12, 2022 4:37 am

DrBreath wrote:
Wed May 11, 2022 9:00 pm
Hi, As it says in the title I wanted to know if there is a way to make files for each language for example:

english_Hints.rpy

spanish_Hints.rpy
You can separate code in files however you like, but all files will be loaded by RenPy at startup. You will have to use translation framework to differentiate them.
DrBreath wrote:
Wed May 11, 2022 9:00 pm
I ask this because I have already tried with

Code: Select all

_(" ")
and

Code: Select all

__(" ")
(which by the way I know how to use, it just doesn't work).
Then you are using it wrong, because it works for me.
< < insert Rick Cook quote here > >

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: File by language

#3 Post by m_from_space » Thu May 12, 2022 1:01 pm

I would recommend reading all of this for making translations:

https://www.renpy.org/doc/html/translation.html

(I'm not sure I get the question, because Renpy will create separate translation files for other languages than the original game language you write the code in.)

DrBreath
Newbie
Posts: 9
Joined: Fri Apr 01, 2022 4:12 pm
Contact:

Re: File by language

#4 Post by DrBreath » Thu May 12, 2022 1:40 pm

Ocelot wrote:
Thu May 12, 2022 4:37 am
DrBreath wrote:
Wed May 11, 2022 9:00 pm
Hi, As it says in the title I wanted to know if there is a way to make files for each language for example:

english_Hints.rpy

spanish_Hints.rpy
You can separate code in files however you like, but all files will be loaded by RenPy at startup. You will have to use translation framework to differentiate them.
DrBreath wrote:
Wed May 11, 2022 9:00 pm
I ask this because I have already tried with

Code: Select all

_(" ")
and

Code: Select all

__(" ")
(which by the way I know how to use, it just doesn't work).
Then you are using it wrong, because it works for me.
Yeah, what happens is that if

Code: Select all

_(" ")
does not work I use the

Code: Select all

__(" ")
(which translates almost everything), but there are some things that although the translation is generated when testing it inside the game, it does not translate.

DrBreath
Newbie
Posts: 9
Joined: Fri Apr 01, 2022 4:12 pm
Contact:

Re: File by language

#5 Post by DrBreath » Thu May 12, 2022 1:44 pm

m_from_space wrote:
Thu May 12, 2022 1:01 pm
I would recommend reading all of this for making translations:

https://www.renpy.org/doc/html/translation.html

(I'm not sure I get the question, because Renpy will create separate translation files for other languages than the original game language you write the code in.)
Sorry if it was not understood Dx, what I meant is that translations are generated but when testing the game it does not translate so what I want to do is to create a code for each language instead of generating translation files.

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: File by language

#6 Post by m_from_space » Thu May 12, 2022 2:40 pm

DrBreath wrote:
Thu May 12, 2022 1:44 pm
Sorry if it was not understood Dx, what I meant is that translations are generated but when testing the game it does not translate so what I want to do is to create a code for each language instead of generating translation files.
What exactly is not working? Dialogue getting translated or other stuff like menus and strings that are not dialogue? If nothing works, then how exactly did you tell Renpy to activate the other language? Can you show some code?

DrBreath
Newbie
Posts: 9
Joined: Fri Apr 01, 2022 4:12 pm
Contact:

Re: File by language

#7 Post by DrBreath » Fri May 13, 2022 12:24 am

m_from_space wrote:
Thu May 12, 2022 2:40 pm
DrBreath wrote:
Thu May 12, 2022 1:44 pm
Sorry if it was not understood Dx, what I meant is that translations are generated but when testing the game it does not translate so what I want to do is to create a code for each language instead of generating translation files.
What exactly is not working? Dialogue getting translated or other stuff like menus and strings that are not dialogue? If nothing works, then how exactly did you tell Renpy to activate the other language? Can you show some code?
What I can't translate is a menu, the translation is generated but it doesn't work inside the game and as for "how I told" renpy to activate the other language I used the classic one:

Code: Select all

               vbox:
                    style_prefix "radio"
                    label _("Language")
                    textbutton _("English") action Language(None)
                    textbutton _("Spanish") action Language("spanish")

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

Re: File by language

#8 Post by Ocelot » Fri May 13, 2022 3:36 am

Show how do you display your menu.
< < insert Rick Cook quote here > >

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: File by language

#9 Post by m_from_space » Fri May 13, 2022 6:59 am

I assume that your menu items are not translated, because you fiddled with the "choice" screen in screens.rpy? Because I did too and had to realize that whenever you add something to your menu entries (like quotation marks or some formatting) and want translation to work, you cannot just do:

Code: Select all

screen choice(items):
    for i in items:
        textbutton "» "+ i.caption + " «" action i.action
But you have to write:

Code: Select all

screen choice(items):
    for i in items:
        textbutton "» [i.caption!t] «" action i.action

DrBreath
Newbie
Posts: 9
Joined: Fri Apr 01, 2022 4:12 pm
Contact:

Re: File by language

#10 Post by DrBreath » Fri May 13, 2022 3:00 pm

m_from_space wrote:
Fri May 13, 2022 6:59 am
I assume that your menu items are not translated, because you fiddled with the "choice" screen in screens.rpy? Because I did too and had to realize that whenever you add something to your menu entries (like quotation marks or some formatting) and want translation to work, you cannot just do:

Code: Select all

screen choice(items):
    for i in items:
        textbutton "» "+ i.caption + " «" action i.action
But you have to write:

Code: Select all

screen choice(items):
    for i in items:
        textbutton "» [i.caption!t] «" action i.action
I will try it thank you

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], minyan