how to 'conversation.dialogueEntries.Add(entry)' in other languages

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Dralks
Posts: 44
Joined: Mon May 24, 2021 6:19 pm

how to 'conversation.dialogueEntries.Add(entry)' in other languages

Post by Dralks »

Hi!

I changed the import to excel code heavily to adapt it to my spread sheet, our game has around 9 languages and hundreds of texts so doing it by hand is not an option, after a couple of days I managed to be able to import 100% of the conversations with my current excel format, the only issue I have now is language, I'm trying to add the conversation on a specific language, so on this scenario I want it to add to dialogue entries of the French conversation:

Image

what I would like to see is all the given text being added in the given language:


Image

how do I add dialogues only to the given language while leaving every unrelated language untouched?
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: how to 'conversation.dialogueEntries.Add(entry)' in other languages

Post by Tony Li »

Hi,

The French translation for a dialogue entry's "Dialogue Text" field should be in a field named "fr".

If your spreadsheet contains all languages, you could import them all at once.

If you have a separate spreadsheet for each language, then let's assume you've already imported the default language. This means your dialogue database has all of the conversations' dialogue entries, but the "fr" fields are currently blank.

When you import the French spreadsheet, you will need to identify the dialogue entry associated with each row of your spreadsheet. This will be easiest if you've assigned a unique ID to each row in your spreadsheet, or if the rows are in the same order in all languages so you can use the row number. When importing the default language, set the dialogue entry's Title or Description to the unique ID or row number. This way you can find the same dialogue entry when importing the French spreadsheet, such as:

Code: Select all

var conversation = database.GetConversation("Some Conversation");
var dialogueEntry = conversation.dialogueEntries.Find(entry => entry.Title == rowNumber.ToString());
Field.SetValue(dialogueEntry.fields, "fr", frenchTranslation, FieldType.Localization);
(EDIT: Added Localization type to Field.SetValue line per Dralks below)
Dralks
Posts: 44
Joined: Mon May 24, 2021 6:19 pm

Re: how to 'conversation.dialogueEntries.Add(entry)' in other languages

Post by Dralks »

Field.SetValue(dialogueEntry.fields, "fr", frenchTranslation); is exactly what I was missing, now everything works perfectly, just had to add the localization type at the end 'Field.SetValue(entry.fields, "fr", row.Text[x], FieldType.Localization);'

Thank you Tony, you never miss.
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: how to 'conversation.dialogueEntries.Add(entry)' in other languages

Post by Tony Li »

Glad to help!
Post Reply