Custom language real time translation problem

0 favourites
  • 3 posts
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • I am building a translator for my language and I quite know how I'm gonna do the rest of the engine, but I am stuck on a problem that I wanted to do first, as the rest of the engine will be easy to programm.

    Works like this: When I type a word into the TextBox, it adds the word (if it's detected) into a Text instance variable called Output. Then it sets the Text to Output.

    Problem: Words getting overwritten; when a user types for example "You are cool", it translates to "i pai" and when I write any of the already used words again, e.g. "You are cool, you", it doesn't add another "you" at the end as it should. *It's because the value is already in the variable.*

    Problem 2: My realtime breaks at the point when I start deleting stuff. It adds a word to a variable when it detects it and then sets the variable equal to the display text, but the strings in the variable don't get removed. Is there a way to find a value in a variable and replace it with "" so that it removes it and the space it took as well?

    My Capx:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • To your first issue, it only shows it once as you only told it to trigger once.

    Scanning it all every tick is basically rereading everything on a 'find'.

    I tried to condition it, but it will always add another 'I' due to the rescanning.

    You would probably do better trying to read and store each word separately, (in an array for example) so then you would know which words you processed and which ones you didn't.

    Using find likely won't work. "I went to the zoo to see the zoo keeper" would not see the second 'to', the second 'the' or the second 'zoo', so your process would fail.

    Storing as an array, you could keep track of each word, and the associated translation.

    EG: You could have an array that has the word and true/false if you've translated it.











    Finally, I'd also suggest something like a JSON table or database to do your lookups, it would be a lot easier to maintain. Making the table online would mean you could update the words without having to make a new release.

    Hope that helps?

  • Interesting idea, especially for the online database part. Think I might do just that! Thanks This helps me quite a lot!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)