alan-mj-lin / Sporeas

TJC projection webapp for service use.
1 stars 0 forks source link

automatically fill the other textarea with a translation #75

Closed hchiam closed 4 years ago

hchiam commented 4 years ago

https://github.com/alan-mj-lin/Sporeas/issues/51#issuecomment-584394703

Note: Still WIP as of right now. I had to add code to use delays and avoid getting blocked. I need to retest once I get unblocked.

alan-mj-lin commented 4 years ago

@hchiam how accurate is the auto-translation?

hchiam commented 4 years ago

@alan-mj-lin Google translate isn't perfect, but it's getting better since it started using a different model, especially on the sentence level. (EDIT: here's a link https://www.blog.google/products/chrome/even-better-translations-chrome-one-tap/)

But I'm just thinking of saving on typing. You hit a button to "confirm to use suggestion", and then edit just one or two characters. Might come in handy if you're waiting for a translator.

You can test out sentences here: https://codepen.io/hchiam/pen/eYNgQNV

(EDIT:) Todo:

hchiam commented 4 years ago

@alan-mj-lin ready for you to review/merge

Feb-27-2020 17-24-01

alan-mj-lin commented 4 years ago

So I've noticed that it doesn't adjust the translation if I edit the english; you apparently have to fully erase the chinese for it to do an updated translation. Is there a way that can improve?

hchiam commented 4 years ago

So I've noticed that it doesn't adjust the translation if I edit the english; you apparently have to fully erase the chinese for it to do an updated translation. Is there a way that can improve?

Yes! Here's what I think:

(Given that the user is inputting English:)
if user didn't edit Chinese already:
    - Replace Chinese textarea.
else user already edited Chinese (let's avoid frustrating deletions):
    - Show a separate display: "(...new suggestion...)". The user can copy-paste parts they want.
    - Show a new button to let user to completely replace suggestion: "Use suggestion".

And if the user is inputting Chinese, it should work the other way around. The code in translation-helper.js is already designed to work "vice-versa".

hchiam commented 4 years ago

WIP: thinking about the "user can copy-paste parts they want" part of my previous comment.

Feel free to try it out now though.

hchiam commented 4 years ago

@alan-mj-lin ok i think this is ready for you to review and merge. Let me know if you want me to add test cases for this.

alan-mj-lin commented 4 years ago

@hchiam i don't see the suggestion buttons

hchiam commented 4 years ago

You have to be editing both sides to see the buttons. The buttons show up to avoid replacing the entire text, especially when you've already corrected previous lines.

Notice how I type a little in the Chinese (to simulate editing/correcting that line), and the text turned black. This looping gif is about 28 seconds long:

Mar-05-2020 23-43-47

hchiam commented 4 years ago

@alan-mj-lin I've added a test that shows how the announcement translation suggestions work.