Twine text translating

Hello I am trying to create JavaScript for my twine game that automatically reads and then translates every word on the passage from English to french then I want to try to make it save for next start up and make trigger/checkbox (from my settings passage) activate the code after the variable called $language was set to the string “true” and I want to do this without making new passages with the translations.

does anyone know how?

I’m not fluent with translating websites, but I know it’s not an exact science for automating the process. Google Translate is free. You may find this page useful in adding the JavaScript to automatically translate content within your story.

https://www.geeksforgeeks.org/add-google-translate-button-webpage/

You previously asked about saving the state of the story between sessions. Did you make any progress with that? Because that is how you will save the $language variable.

Get that working first and then you can figure out a strategy for displaying multiple languages in your story. Off the top of my head, I believe having each passage store both a French and English version of it’s own content, already translated, might be the most effective strategy.

No I did not

@HAL9000 thanks but the code on the website does not show the language select box when put onto my twine game

Strange. It pulls the language select button for all languages available on Google Translate for me. Works like a charm, but I didn’t test it in a Harlowe story.

However, this is not a complete, ideal solution and requires quite a bit of testing. I’ve never seen an interactive fiction integrated with google translate before. Unless someone else chimes in with another option, I believe my suggestion of putting in language translations in each passage is your best and most straight forward option. No JavaScript would be needed. This would require you to solve the “game state” saving I touched upon in the other topic though.

Perhaps letting this topic sit for a day or so will garner more replies.

okay thanks for trying

@manonamora

Sorry, but I don’t have an answer for this one, further than what @HAL9000 already shared. And a quick Google search shows that Chrome’s translate function can do that automatically (with limits, obv), but really the only ideal solution is to have the translation manually done, because you’d be sure your text isn’t borked by the automatic translation (that’s what I’ve done personally, but then again, I speak both languages :woman_shrugging:).

(also, please don’t @ people that aren’t participating in a help thread. Just because someone can answer one question doesn’t mean they have a solution for everything in that format)

1 Like