Renpy lang change?

Elis15

Newbie
May 7, 2018
42
6
Hello, how change lang setting in renpy.

add in script.rpy after laber start
renpy.change_language("Russian")

not work
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
Well, first of all did you create the translation files already? What is the translation folders name? (The /game/tl/None folder is the language in which the script files are written, while any other folder inside the /tl/ folder are translations of the None language)

Then next question, do you want it to "always" start in russian language or do you want to give the users an option to change it? Which language should be shown at first start? The one in which the main script files are written or a translation (i.e. russian?)

This would be a box in the preference menu:
Code:
    vbox:
            style_prefix "radio"
            textbutton _("English") action Language(None)
            textbutton _("Deutsch (Ohne UI)") action Language("russian")
Which coul be placed in the "screens.rpy" under "screen preferences():" where it says something like this:
Code:
vbox:
                    style_prefix "check"
                    label _("Skip")
                    textbutton _("Unseen Text") action Preference("skip", "toggle")
                    textbutton _("After Choices") action Preference("after choices", "toggle")
                    textbutton _("Transitions") action InvertSelected(Preference("transitions", "toggle"))

######## start around here

A nicer way of adding the button would be like this:
Code:
vbox:
                    style_prefix "check"
                    label _("Skip")
                    textbutton _("Unseen Text") action Preference("skip", "toggle")
                    textbutton _("After Choices") action Preference("after choices", "toggle")
                    textbutton _("Transitions") action InvertSelected(Preference("transitions", "toggle"))



                vbox:
                    label _("Language")
                    if config.language == None: ############## if the current language is english then show "russian" as a button to click on.
                        textbutton _("Russian"):
                            action Language("russian")
                    else:   ################ else show english to click on ;)
                        textbutton _("English"):
                            action action Language("english")
 
  • Like
Reactions: Elis15

Elis15

Newbie
May 7, 2018
42
6
Well, first of all did you create the translation files already? What is the translation folders name? (The /game/tl/None folder is the language in which the script files are written, while any other folder inside the /tl/ folder are translations of the None language)
Yes, i create translation files.
folder: \tl\Russian\

need start game with Russian lang
and no need options for change\select lang, i need always use translation
 

Elis15

Newbie
May 7, 2018
42
6
Ok. add

Code:
                vbox:
                    style_prefix "radio"
                    label _("Lang")
                    textbutton _("English") action Language(None)
                    textbutton _("Russian") action Language("Russian")
But game load \game\scripts\intro.rpy
not \game\tl\Russian\scripts\intro.rpy

The names of the options themselves changes (but this is renpy "self" functional)
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
hmmm, did you create the translation files with the ren'py launcher or did you just copy the exact same intro.rpy and translated it then?
There are differences :)

But usually what you want (if you don't want the english or "None" language at all) is this variable somewhere above label start:
Code:
define config.language = "Russian"

label start:
(Please make sure it's really "R"ussian not "r"ussian, python is case sensitive meaning Russian is not russian.)[/code]
 
  • Like
Reactions: Elis15

Elis15

Newbie
May 7, 2018
42
6
hmmm, did you create the translation files with the ren'py launcher or did you just copy the exact same intro.rpy and translated it then?
There are differences :)

But usually what you want (if you don't want the english or "None" language at all) is this variable somewhere above label start:
Code:
define config.language = "Russian"

label start:
(Please make sure it's really "R"ussian not "r"ussian, python is case sensitive meaning Russian is not russian.)[/code]
I plan to translate the game. But I can not figure out how to make the game read not old files, but translated from tl/Russian/

Yes i use renpy for create translation files
and know about R/r
 

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,705
Perhaphs you need to change "persistent.lang" too.
(and put you language changes inside "slashcreen" label so player can choose language before load of main menu)

Also, if the problem is with menus, you need to translate other scripts in /tl/Russian folder, not only script.rpy
 
  • Like
Reactions: Elis15

Elis15

Newbie
May 7, 2018
42
6
Perhaphs you need to change "persistent.lang" too.
(and put you language changes inside "slashcreen" label so player can choose language before load of main menu)

Also, if the problem is with menus, you need to translate other scripts in /tl/Russian folder, not only script.rpy

Code:
init -3 python:
   if persistent.lang is None:
       persistent.lang = "Russian"

   lang = persistent.lang
?
But in wiki not say, in which file need add it
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,976
16,231
But in wiki not say, in which file need add it
In any file you want. Ren'py don't care about the files (only "guy.rpy" is hard coded in the core). The only thing you must take care about is the init level, since the said init block will be played according to this level.
 

Elis15

Newbie
May 7, 2018
42
6
In any file you want. Ren'py don't care about the files (only "guy.rpy" is hard coded in the core). The only thing you must take care about is the init level, since the said init block will be played according to this level.

That a problem. I try in various files

Code:
init -3 python:
persistent.lang = "Russian"
lang = persistent.lang

Code:
File "game/screens.rpy", line 80: python block expects a non-empty block.
    init -3 python:
                   ^

File "game/screens.rpy", line 81: expected statement.
    persistent.lang = "Russian"
                     ^

File "game/screens.rpy", line 82: expected statement.
    lang = persistent.lang
 

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,705
That a problem. I try in various files

Code:
init -3 python:
persistent.lang = "Russian"
lang = persistent.lang

Code:
File "game/screens.rpy", line 80: python block expects a non-empty block.
    init -3 python:
                   ^

File "game/screens.rpy", line 81: expected statement.
    persistent.lang = "Russian"
                     ^

File "game/screens.rpy", line 82: expected statement.
    lang = persistent.lang
Think in identation

Code:
init -3 python:
       persistent.lang = "Russian"
       lang = persistent.lang
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,976
16,231
Code:
File "game/screens.rpy", line 80: python block expects a non-empty block.
    init -3 python:
                   ^
I know that Ren'py errors can be hard to understand, but it's one of the easiest. If Ren'py complain that the block is empty, it mean that whatever follow is seen as independent from the block.
And like @mgomez0077 said, here it's because of the indentation ; in fact it's (almost) always because of the indentation.
 

Elis15

Newbie
May 7, 2018
42
6
Thank's all.

in splash_screen.rpy add $ renpy.change_language("russian")

Code:
image splash1 = "images/splashscreen/splash1.jpg"
image splash2 = "images/splashscreen/splash2.jpg"
image splash3 = "images/splashscreen/splash3.jpg"

label splashscreen:
    $ renpy.change_language("russian")
    scene black
    $renpy.pause(1, hard = True)

    show splash1 with dissolve
    $renpy.pause(2, hard = True)
    hide splash1 with dissolve

    show splash2 with dissolve
    $renpy.pause(2, hard = True)
    hide splash2 with dissolve

    show splash3 with dissolve
    $renpy.pause(2, hard = True)
    hide splash3 with dissolve

    return
- milf city

Maked new translate, but change Russian > russian. And its work.
Ya i know about R\r, but its realy help..