Translation of scrolling credits
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.
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.
-
- Newbie
- Posts: 4
- Joined: Sun Feb 18, 2018 8:56 am
- Contact:
Translation of scrolling credits
Hello,
I've been having trouble with the code based on this one: viewtopic.php?f=51&t=22481
Whole game has two languages which can be freely switched on the fly, but the credits for some reasons cannot be translated and always show the English ones. So far no standard Ren'Py options worked, neither did workarounds listed in this thread: viewtopic.php?f=8&t=47159. I am unable to assign two different credits to show up for different languages as well: one always overrides the other.
I've been having trouble with the code based on this one: viewtopic.php?f=51&t=22481
Whole game has two languages which can be freely switched on the fly, but the credits for some reasons cannot be translated and always show the English ones. So far no standard Ren'Py options worked, neither did workarounds listed in this thread: viewtopic.php?f=8&t=47159. I am unable to assign two different credits to show up for different languages as well: one always overrides the other.
- Ocelot
- Lemma-Class Veteran
- Posts: 2384
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Translation of scrolling credits
None of the creits strings in your first example are marked as translateable, so it is expected. TO make strings eligible for translation in first place you need to define them using underscore function: _('some text')
< < insert Rick Cook quote here > >
-
- Newbie
- Posts: 4
- Joined: Sun Feb 18, 2018 8:56 am
- Contact:
Re: Translation of scrolling credits
I have already tried to define them as _('some text'), __ ('some text'), (_('some text')), and who knows how else. No defining worked so far, ren'py simply ignores that.UsagiToxic wrote: ↑Sun Feb 18, 2018 9:10 am So far no standard Ren'Py options worked, neither did workarounds listed in this thread: viewtopic.php?f=8&t=47159.
- Ocelot
- Lemma-Class Veteran
- Posts: 2384
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Translation of scrolling credits
Show, how exactly you doing that. WOrks perfectly for me, so there is somethng wrong in how you are doing it.
< < insert Rick Cook quote here > >
-
- Newbie
- Posts: 4
- Joined: Sun Feb 18, 2018 8:56 am
- Contact:
Re: Translation of scrolling credits
Code: Select all
credits = _('title', 'author')
Code: Select all
credits = __('title', 'author')
Code: Select all
credits = __ ('title', 'author')
Code: Select all
credits = __ (_('title'), _('author'))
Code: Select all
credits = _(_('title', 'author'))
Code: Select all
credits_s = _("{size=80}Credits\n\n")
Code: Select all
credits_s = _('{size=80}Credits\n\n')
If you have it perfectly working, I would love to see how and what should I do.
- Ocelot
- Lemma-Class Veteran
- Posts: 2384
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Translation of scrolling credits
By "show, how exactly you doing that", I meant, show some code which I could run, test and see problems.
Anyway, a few points:
1) Translatable strings should be defined at init time. Easiest way to do this is to use define statement:
define authors = (_('title'), _('author'))
2) Combining strings for showing, on the other hand, should be done immideately before showing credits (preferably in screen itself). Do not store them by creating whole text in init time! Otherwise even if you change language, it will not change already rendered text.
3) Do a clean restart every time when testing, do not load game. Sometimes string are saved with the game and translation would not affect them later.
Anyway, a few points:
1) Translatable strings should be defined at init time. Easiest way to do this is to use define statement:
define authors = (_('title'), _('author'))
2) Combining strings for showing, on the other hand, should be done immideately before showing credits (preferably in screen itself). Do not store them by creating whole text in init time! Otherwise even if you change language, it will not change already rendered text.
3) Do a clean restart every time when testing, do not load game. Sometimes string are saved with the game and translation would not affect them later.
< < insert Rick Cook quote here > >
-
- Newbie
- Posts: 4
- Joined: Sun Feb 18, 2018 8:56 am
- Contact:
Re: Translation of scrolling credits
I doubt I can redefine credits. I have very little understanding of ren'py and the code isn't mine (I am authorized to make a translation, though), plus in the original cookbook code everything is in init python.Ocelot wrote: ↑Sun Feb 18, 2018 5:56 pm
Anyway, a few points:
1) Translatable strings should be defined at init time. Easiest way to do this is to use define statement:
define authors = (_('title'), _('author'))
2) Combining strings for showing, on the other hand, should be done immideately before showing credits (preferably in screen itself). Do not store them by creating whole text in init time! Otherwise even if you change language, it will not change already rendered text.
If there is no way to make these credits translatable, then I should probably notify the author.
- Ocelot
- Lemma-Class Veteran
- Posts: 2384
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Translation of scrolling credits
Cookbook recipe was made before translations existed at all.in the original cookbook code everything is in init python
The reason that you need to mark strings as translatable is simple: not every string is text to be translated: you don't want to translate names of labels to jump to or path to file to open. Some things can be done automatically (like text in menus ore character dialogue), because it is obvious where you would use it. In general Python code it is impossible, because you can literally do anything with those strings. So RenPy defers to hints from developer for those.
The combining strings problem is completely different. RenPy handles translations by creating objects, which returns one or other sequence of symbols, depending on selected language. You can imagine actor which can recite a poem in different languages. So, when in US, he spokes English, in France — French, etc. By using that string in your code, you are asking actor to recite a poem and write it on paper. So, if you ask actor in US, you will get text written in English. If then you move to Germany, even though actor will recite poem in German now, text on your paper will still be in English!
This is why using strings and saving result causes problems if original strings were to change.
So, to translate credits, you need to remake them to be translateable in the first place.
< < insert Rick Cook quote here > >
Who is online
Users browsing this forum: Ahrefs [Bot], Ocelot