Annoying problem with I2 integration and lua

Announcements, support questions, and discussion for the Dialogue System.
diccon
Posts: 27
Joined: Wed Sep 23, 2020 2:20 pm

Annoying problem with I2 integration and lua

Post by diccon »

So the integration with I2 is really good but there is one thing that makes it a pain and that is the default I2 translation inserts spaces into the text which causes the lua to break. e.g. "My name is [var=Conversant]" becomes "Mon nom est [var = Conversant]".

I know this isn't directly a fault of Dialogue System, I've also brought it up on the I2 forum but they did not respond, so maybe this is something people on here have run into and found a workaround for. Currently my solution is to dump everything into a spreadsheet and find/replace all the instances but I think this not going to be sustainable for the duration of the project.

Thanks for any suggestions!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Annoying problem with I2 integration and lua

Post by Tony Li »

Hi,

I'll look into allowing spaces in markup tags. As you said, the real solution should be that i2 doesn't insert spaces. But this will probably be an adequate workaround for [var=variable] tags.

[lua(code)] tags, on the other hand, may still be an issue, in which case the only solution is for i2 to fix this because you can't just go inserting random spaces into code.
diccon
Posts: 27
Joined: Wed Sep 23, 2020 2:20 pm

Re: Annoying problem with I2 integration and lua

Post by diccon »

Yes its a few more things than just "[var = ", it also inserts spaces after [lua and also tables e.g. Variable["index"]. value etc. which make the logic break.

I believe its the google translate that is causing the problem so when we get to the stage of getting the whole database professionally translated this should hopefully go away, but for most of the project I need the auto translate to work so that the logic isn't broken.

I will press them for a reply though unfortunately they are not very responsive. I think some kind of [donottranslate ..] markup would be ideal.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Annoying problem with I2 integration and lua

Post by Tony Li »

It isn't ideal, but while you're using autotranslate perhaps you could manually do a global search & replace in the spreadsheet for "var = " and change it to "var=", etc.
diccon
Posts: 27
Joined: Wed Sep 23, 2020 2:20 pm

Re: Annoying problem with I2 integration and lua

Post by diccon »

This is what I'm doing right now as I'm developing the system but I'm not sure if that will be acceptable as a workflow to hand off to a content creator, I'm looking into how feasible it is to write my own markup tag.

I'm wondering if anyone else has dealt with this problem as it is one of the first problems I ran into when using the two packages together.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Annoying problem with I2 integration and lua

Post by Tony Li »

Hi,

You can probably use i2 Localization Parameters, maybe in combination with an OnConversationLine() method to strip the {[...]} from the text.
diccon
Posts: 27
Joined: Wed Sep 23, 2020 2:20 pm

Re: Annoying problem with I2 integration and lua

Post by diccon »

Bringing this back from the dead as I managed to get some help from I2. They have their own do not translate tags [i2nt]..[/i2nt] so it is possible for me to wrap all the lua code in these and have a ConversationLine handler that strips it out of the subtitle.
The one issue I am finding is that when I run DS to I2 from the tool "[/i2nt]" in Dialogue System becomes "[%2Fi2nt]" in I2 which of course doesn't work. It looks like DS is doing this substitution in the AddFields function, is there a reason for it?

Another tool related issue I've noticed is that if I make edits to conversation entries they do not get pushed to I2, is there a reason for that also?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Annoying problem with I2 integration and lua

Post by Tony Li »

Hi,

I'll update the tool to leave [i2nt] and [/i2nt] tags untouched. The tool temporarily converts "/" to "%2F" (the code for forward slash) so i2 doesn't interpret the "/" as subdividing the i2 term.

Conversation entries should get pushed when you click the "To I2" button.
diccon
Posts: 27
Joined: Wed Sep 23, 2020 2:20 pm

Re: Annoying problem with I2 integration and lua

Post by diccon »

Thanks, for the dialogue entries it looks like it only pushes an entry when the I2 term is empty

Code: Select all

if (termData.Languages.Length > 0 && string.IsNullOrEmpty(termData.Languages[0])) termData.Languages[0] = value;
I think it could use String.Compare to push edited entries.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Annoying problem with I2 integration and lua

Post by Tony Li »

Hi,

Tomorrow, I'll post a patch that does String.Compare and also leaves [/i2nt] untouched.
Post Reply