[SOLVED] How to make gender-specific dialogue translatable

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
Zeroji
Newbie
Posts: 4
Joined: Sun Aug 11, 2019 10:42 am
Github: Zeroji
Contact:

[SOLVED] How to make gender-specific dialogue translatable

#1 Post by Zeroji »

Hi,

I'm part of a small team writing a Ren'Py game where the player can choose the main character's gender. It has become quickly obvious that this will massively impact dialogues, and since we're French, I want to make sure I can write scripts in French while making them easy (for me or others) to translate.

The initial idea to solve this was simple:

Code: Select all

if male:
    x "Es-tu prêt ?"
else:
    x "Es-tu prête ?"
The issue: both those strings would translate to "Are you ready?". This is annoying for translation, but it's fine.
A bigger issue is that "C'est son sac" (gender neutral) translates either to "it's his bag" or "it's her bag", and I cannot write if statements for every possible language with gender differences.

A solution I saw while browsing the forums was using pronoun variables, like "his_or_her" but that doesn't cover cases like "prêt/prête" (and French has a lot of those), and it tries to replicate language features programmatically, which is bound to fail at some point.

My latest attempt involved using None translations: generating translations for French (our default project language), then moving them to the tl/None folder and keeping only the gendered dialogue, such as:

Code: Select all

translate None chapter_00_xxxx:
    # x "Es-tu prêt ?"
    if male:
        x "Es-tu prêt ?"
    else:
        x "Es-tu prête ?"
This appeared to work, but since I kept only the gendered strings, suddenly all other strings disappeared from my game. I don't want to create a translation file riddled with statements that translate "baguette" to "baguette", but I don't know how to deal with all of this.

If anyone has successfully implemented gender-specific dialogue in a way that's relatively easy to translate, your advice would be greatly appreciated!

Thanks for taking the time to read me

Zeroji
Last edited by Zeroji on Tue Aug 20, 2019 12:53 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: How to make gender-specific dialogue translatable

#2 Post by philat »

I mean, them's the breaks. Gendered language is inconvenient. Don't know what to say. Ren'py isn't specifically built to deal with this kind of stuff very easily -- if you're open to other stuff, I'd look into ink.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to make gender-specific dialogue translatable

#3 Post by namastaii »

I think the easiest solution would be to actually have two versions of the French. And maybe because there is a masculine and feminine version of the word, you could just name them française and français? haha or french_female, french_male etc

Have the player choose their gender and then something like

Code: Select all

if gender == male:
    $ renpy.change_language("french_male")
else:
    $ renpy.change_language("french_female")
for multiple languages:

Code: Select all

menu:
    "French":
        if gender == male:
            $ renpy.change_language("french_male")
        else:
            $ renpy.change_language("french_female")
    "Deutsch":
        if gender == male:
            $ renpy.change_language("deutsch_male")
        else:
            $ renpy.change_language("deutsch_female")

Zeroji
Newbie
Posts: 4
Joined: Sun Aug 11, 2019 10:42 am
Github: Zeroji
Contact:

Re: How to make gender-specific dialogue translatable

#4 Post by Zeroji »

I've thought about this too, but it makes script modifications really heavy... for example, if I were to change a single, non-gendered line, I'd have to edit it in the script (French), in the male (French) translation and in the female (French) translation. In addition to this, translators would need to maintain two different versions, or copy and paste with the risk of missing things

I think python-based translation files might work:

Code: Select all

translate None chapter_00_xxxx:
    # x "Es-tu prêt ?"
    if male:
        x "Es-tu prêt ?"
    else:
        x "Es-tu prête ?"
But as I mentioned above, when I declare my 4 gendered strings in the translation file, once the game encounters the first gendered string it'll display it and then skip all non-gendered strings, for example:

Code: Select all

- Whose bag is this?
- I think it's hers (gendered)
- Why is it here?
- She must have forgotten it! (gendered)
would end up looking (in-game) like this:

Code: Select all

- Whose bag is this?
- I think it's hers (first non-gendered string in the translation file)
(skipping all non-gendered strings from here, for some reason)
- She must have forgotten it!
So far we have like 4 gendered strings out of 30, obviously it's pretty troublesome when most of that disappears. The solution I can see is providing a French→French translation for every single line, but I'd love to figure out a more elegant way to work around this issue.

That being said, for translations to other languages it looks to be the simplest method.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to make gender-specific dialogue translatable

#5 Post by namastaii »

as for possibly missing things, you could always add a #comment by every line that has a gender specific word to be changed? But that is probably going to change from language to language if you do more than one translation... I'm not sure about any of this either as I haven't really done it yet haha

you could omit people calling the player he/she and just say "that person" or something but I know that doesn't really take care of words like you said, baguette or whatever. Depending on your game, people would be speaking to you directly mostly anyway, right? They'd be calling you by name or not needing to reference you or your gender unless it's someone on the side (which might not happen very often) "that girl there, she stole my purse!"

I don't know much about french. I took it for two years in school and remember nothing but I know some korean and their language isn't as heavily reliant on gender really

Zeroji
Newbie
Posts: 4
Joined: Sun Aug 11, 2019 10:42 am
Github: Zeroji
Contact:

Re: How to make gender-specific dialogue translatable

#6 Post by Zeroji »

Yeah that's the issue, it may vary heavily from one language to another... For example, "are you happy?" would be gendered in French depending on which adjective you use to translate "happy". In some languages, there are gendered pronouns which makes every line addressing the player gendered.

I'm mostly trying to figure out that last bit about having non-declared translations... How to tell the game "use translated strings if there are some, otherwise use default strings"?

rames44
Veteran
Posts: 233
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: How to make gender-specific dialogue translatable

#7 Post by rames44 »

One solution that occurs to me are custom text tags. Supposing that you created your translation string as

Code: Select all

“{male}Es-tu prêt{/male}{female}Es-tu prête{/female}”
“It’s {male}his{/male}{female}her{/female} bag.”
And then arranged your custom text tags “male” and “female” to respect your players gender setting and either render the contained text or else eat it.

Seems to me that that would work, and would leave you with a 1-to-1 correlation between English and French strings.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to make gender-specific dialogue translatable

#8 Post by namastaii »

That seems it would take up a lot less space but probably take longer than just copying the entire sentence and putting if gender == "male" above it

Zeroji
Newbie
Posts: 4
Joined: Sun Aug 11, 2019 10:42 am
Github: Zeroji
Contact:

Re: How to make gender-specific dialogue translatable

#9 Post by Zeroji »

rames44 wrote: Mon Aug 12, 2019 11:52 am One solution that occurs to me are custom text tags.
Thank you so much for this!!

I've made two really basic custom tags: (Custom Text Tags - Ren'Py Documentation)

Code: Select all

init python:
    def tag_male(tag, argument, contents):
        if gender == 'm':
            return contents
        return []
    
    def tag_female(tag, argument, contents):
        if gender == 'f':
            return contents
        return []
    
    config.custom_text_tags['_m'] = tag_male
    config.custom_text_tags['_f'] = tag_female
Now I can have French gendered strings directly in my script (that's still the easiest place for me to put them), looking quite clean:

Code: Select all

x "Comment vas-tu ? Te sens-tu prêt{_f}e{/_f} ?"
And if I want to create English translations I can just ignore the tags, or insert them as needed!
This also completely solves the issue of None translations getting in the way, because I don't need any of them anymore.

Thanks again, made my day!
Last edited by Zeroji on Tue Aug 20, 2019 12:53 pm, edited 1 time in total.

rames44
Veteran
Posts: 233
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: How to make gender-specific dialogue translatable

#10 Post by rames44 »

Cool - glad it worked for you!

Post Reply

Who is online

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