How to find out the current phrase in the original language without switching?

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
barsunduk
Regular
Posts: 33
Joined: Fri Jul 18, 2014 1:06 pm
Completed: «Crystal City», «Mega City», «Kilmonger», «Neuronaut», «Love, Death & Veggies», «Arrow Tourney», «Big Red Hood: Halloween», «Succubus Throne»
Projects: «Swordsman Tourney», «This Tiny Galaxy»
Organization: 7DOTS
itch: 7dots
Contact:

How to find out the current phrase in the original language without switching?

#1 Post by barsunduk »

On the say screen, I process the who and what values. I need to know the replica both in the original language and in the current one. I need to get the phrase in both the original language and its translation in the current language. But renpy.translate_string(what, None) does not work. And I need phrases not only from the translate somelanguage strings section. And for example translate somelanguage start_a723fee8

Is there a way to find out the current phrase in the original language of the game without switching the language of the game?

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: How to find out the current phrase in the original language without switching?

#2 Post by m_from_space »

barsunduk wrote: Tue Mar 28, 2023 10:29 amBut renpy.translate_string(what, None)
This function is only used for string translations and of course only works in the direction of a translation (not the other way around). Also it won't translate a dialogue line, because that's not a string translation formed via functions like _("text") or __("text")...

I don't know what your goal is, but maybe there is another solution to your problem? I don't have an answer to this question.

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

Re: How to find out the current phrase in the original language without switching?

#3 Post by Ocelot »

How it should work if two statements are replaced with one or vice versa?

Code: Select all

label start:
    char1 "hello" id start_12345

translate SomeLanguage start_12345:
    char1 "he..."
    char2 "...llo"
What should happen in this case?
< < insert Rick Cook quote here > >

User avatar
barsunduk
Regular
Posts: 33
Joined: Fri Jul 18, 2014 1:06 pm
Completed: «Crystal City», «Mega City», «Kilmonger», «Neuronaut», «Love, Death & Veggies», «Arrow Tourney», «Big Red Hood: Halloween», «Succubus Throne»
Projects: «Swordsman Tourney», «This Tiny Galaxy»
Organization: 7DOTS
itch: 7dots
Contact:

Re: How to find out the current phrase in the original language without switching?

#4 Post by barsunduk »

Ocelot wrote: Tue Mar 28, 2023 3:33 pm What should happen in this case?
сорян, я в буржуйский не умею, но судя по аве, проще будет так объяснить.
суть в том, что взялся я прикрутить знакомым озвучку к новелле. но мне как-то не улыбается добавлять вручную тысячи строк типа voice "e01.ogg" в скрипт. ну и я родил костыль:

Code: Select all

screen say(who, what):
    on "show" action SetVariable("b_what", str(what))
    #...
а в callback для персонажей Character есть автоматическая озвучка текста из текстбокса:

Code: Select all

def my_callback(event, **kwarg):
    voice_tag = kwarg["voice_tag"]
    if not say_fn and b_what:
        fn = b_what.replace("?", "").replace(":", "")
        if fn:
            fn = str("voice/" + voice_tag + "/" + fn + ".ogg")
            if renpy.exists(fn):
                voice(fn, voice_tag)
                store.say_fn = fn
    if event == "end":
        store.b_what = ""
        store.say_fn = ""
то есть фандабберы тупо в качестве имени файла ставят текст, который и произносят в нём. и мне код написать один раз.
примерно такой вот код работает отлично, только при переключении на буржуйский, игра естественно не видит оригинальные файлы озвучки.
да, можно набросать код, который создаст на основе перевода с русского на английский новый перевод - с английского на русский. причём на основе old-new схемы, чтобы работала renpy.translate_string(b_what, "russian"). тогда всё работает опять же, проверено. но, блин, переводить с русского на английский, чтобы вывести текст на экран, а потом с английского на русский, чтобы его автоматом озвучить... звучит очень неоптимизированно и бредово)) вот я и решил спросить знатоков, есть ли способ тупо получить оригинальный непереведённый текст на языке по умолчанию, независимо от текущего перевода. тогда ухищрения с двойным переводом не нужны будут.

к примеру, вот такая штука не переводит текст в принципе:

Code: Select all

eileen "Текст в скрипте." (multiple=1)
но мне-то нужны и оригинал и перевод.

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

Re: How to find out the current phrase in the original language without switching?

#5 Post by Ocelot »

You can check https://www.renpy.org/doc/html/voice.ht ... atic-voice
In short, every line is assigned an ID, and setting config.auto_voice and naming your voice files in a certain way will cause the game to pick them up without the need to write "voice" everywhere.

Not sure how well it would play with translations, but you can try.

---

Посмотри на эту фичу: https://www.renpy.org/doc/html/voice.ht ... atic-voice
Вкратце, у каждой строки есть свой ID, если присвоить config.auto_voice путь, куда будет подставляться этот ID, то эти файлы будут подхватываться соответствующими строками и проигрываться, без прописывания повсюду "voice".

Не уверен, насколько хорошо это будет работать с переводами, но попробовать стоит.
< < insert Rick Cook quote here > >

User avatar
barsunduk
Regular
Posts: 33
Joined: Fri Jul 18, 2014 1:06 pm
Completed: «Crystal City», «Mega City», «Kilmonger», «Neuronaut», «Love, Death & Veggies», «Arrow Tourney», «Big Red Hood: Halloween», «Succubus Throne»
Projects: «Swordsman Tourney», «This Tiny Galaxy»
Organization: 7DOTS
itch: 7dots
Contact:

Re: How to find out the current phrase in the original language without switching?

#6 Post by barsunduk »

Ocelot wrote: Tue Mar 28, 2023 5:01 pm You can check https://www.renpy.org/doc/html/voice.ht ... atic-voice
спасибо за совет!
надеялся, что не придётся самому переименовывать тысячи файлов, но раз вариантов нет, то чего уж теперь...
нет, ну его нафиг. попробую всё-таки автоматом сделать, пусть и с двойным переводом этим туда-обратно)

User avatar
barsunduk
Regular
Posts: 33
Joined: Fri Jul 18, 2014 1:06 pm
Completed: «Crystal City», «Mega City», «Kilmonger», «Neuronaut», «Love, Death & Veggies», «Arrow Tourney», «Big Red Hood: Halloween», «Succubus Throne»
Projects: «Swordsman Tourney», «This Tiny Galaxy»
Organization: 7DOTS
itch: 7dots
Contact:

Re: How to find out the current phrase in the original language without switching?

#7 Post by barsunduk »


Post Reply

Who is online

Users browsing this forum: No registered users