Jump to content

Way to configure language for a mod?


Recommended Posts

Hello there! So Klei now released new default text characters, allowing me to finally put all those French accents into the mods I made for my friends. However, I'd like to share these mods in the steam workshop when they are fully finished, and I thought it would be cool if you could configure the language the character  speaks (as well as custom item names).

 

The problem is I know nothing about how the config works and can't find any info about it. I think the most simple thing would be to switch between two entire speech files. But how would I then translate lines that come from an action? For instance, look at this (small piece of a lot of) code :

if inst.components.talker ~= nil theninst.components.talker:Say(GetString(inst, "ANNOUNCE_KILLED_INNOCENT_CREATURE"))

This string's speech is in the modmain. But how would you switch between two translations in this case?

 

If anyone could tell me where to find more knowledge about the config (in general), I'd highly appreciate it. :-)

 

Has anyone ever done such a thing? Switching between translations in a config? Thanks in advance :-)

Edited by Thibooms
Link to comment
Share on other sites

Set priority of your character to -0.001 so it will be loaded after DST Patch Francais.

--All clients&server part of modmain:if STRINGS.UI.INTENTION.ANY  == "Tous" then    --Character info    STRINGS.CHARACTER_TITLES.your_char = "Your Char"    STRINGS.CHARACTER_DESCRIPTIONS.your_char = "Perk1\nPerk2\nPerk3"    STRINGS.CHARACTER_QUOTES.you_char = "\"Here I am\""    --French names    STRINGS.NAMES.YOURITEM = "new name"    --French recipes    STRINGS.RECIPE_DESC.YOURITEM = "recipe description"    --Pharases    --It's better do not translate it unless you know how it works exactly.    --Here your should recive english phrases from server and replace it on client by value.    --If you do it on server, all clients will get french phrases.    --(Russian Language Pack uses this method, you can download and look at the code if you like).end
Link to comment
Share on other sites

@Maris, thank you for replying dear big yellow bowtie tailed elephant that you are! :-)

 

 

 

Set priority of your character to -0.001 so it will be loaded after DST Patch Francais.

How do you set priority? Again, sorry, I'm very unfamiliar with configs (I've seen a few though, didn't help a lot).

 

I don't understand what the following is, is it another way of making a "GetModConfigData"? What's the "UI.INTENTION" part?

if STRINGS.UI.INTENTION.ANY  == "Tous" then

So, the way this would work would be... (based on configs I have seen)


configuration_options ={    {        name = "English",        label = "Speak English instead of French", -- I do want the default setting to be English, for the workshop        options =        {            {description = "on (default)", data = 1},            {description = "off", data = 0},        },        default = 1,    },}

And then in the modmain something like

GLOBAL.ENGLISHCONFIG=GetModConfigData("English")

And then I need to use "GLOBAL.ENGLISHCONFIG" somehow by saying "if data=1 then use this part of the file" "if data=0 then use this part of the file"? Or do I use your "if STRINGS.UI.INTENTION.ANY  == "Tous" then"?

 

 

Sorry, I'm trying really hard to understand but it's all a bit confusing to me. Maybe things should be dumbed down even more x)

--> Newbie modder  :wickerbottomthanks:  :happypigs:

 

 

Edited by Thibooms
Link to comment
Share on other sites

How do you set priority?

in modinfo.lua add the line:

priority = -0.001

What's the "UI.INTENTION" part?

This is client side part of the mod. It checks is there mod "DST Patch Francais" installed for this client. It may be any modded variable from STRINGS. Look at .po file of "DST Patch Francais" mod and pick any string.

If user has no French translator, we should not translate your character. Right?

French player will see translated French character. English users will see English names and descriptions.

Sorry, I'm trying really hard to understand

No problems. Client-server connections and relations are really hard to understand. Edited by Maris
Link to comment
Share on other sites

If user has no French translator, we should not translate your character. Right?

Yeah I guess, but doesn't this block you from setting the config manually?

 

So I added everything you said in your first reply. What do I need to put in my config to actually make it work (and how to link it to the code that checks if "DST Patch Français" is installed, I guess that does nothing on its own right now, right?)?

 

Does the priority need to be under "configuration_options" in the modinfo.lua? I just seperated it, but it seems weird because you don't link it to anything.

 

I'm still not quite sure about how you actually link your translated strings to the config... Can I set up my config the way I did in my previous reply? (and still, after that, I don't know how to tell the game which strings to use for regular English/French speech)

 

Thank you for helping me, by the way :-)

 

Edit: I forgot to ask why you put the "Tous". Why? ^^'''

Edited by Thibooms
Link to comment
Share on other sites

I forgot to ask why you put the "Tous"

French translator changes that string to "Tous". So if it's equal "Tous", this means that French translator is installed and active for the player on the server with your character mod. Edited by Maris
Link to comment
Share on other sites

Why you want to configure manually? You want to show French strings to English users?
 

No but if you don't have the translator you should still be able to set the strings to French, right? (For French-speaking users that don't have the translator installed).

 

 

I have tried to set up the config, can't figure out how to make it work though :/. When I set "Speak English" to true, nothing changes. I believe this is because my GLOBAL.ENGLISHCONFIG=GetModConfigData("English") only comes up in the modmain, and I don't know where to set an "if GLOBAL.ENGLISHCONFIG=1 then" (and I have tried by the way but it just crashes because you can't set up a value to that, I'm a little lost...)

 

Edited by Thibooms
Link to comment
Share on other sites

French-speaking users that don't have the translator installed prefer English.

Let people see the text in language that they want to see. :-)

I add native Russian support in my mods. But I know some Russians who like to play with English interface. I can't detect thoughts of plyaers, but I can detect if there is Russian Language Pack installed. And if it's active, I let the player to see translated mod.

Edited by Maris
Link to comment
Share on other sites

@Maris, Okay then! :) Cool

 

Could you know tell me how to make it actually work, please? ^^' I really can't figure it out. What code do I need to add (and where) to actually make the language support work?

 

Say a user doesn't have the French patch, where do I need to put in what code so the game will actually send English lines?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...