earthiverse / altivities

ALT Activities & Games
MIT License
3 stars 11 forks source link

Apostrophes in wordlists #26

Closed buscandoaverroes closed 2 years ago

buscandoaverroes commented 2 years ago

The vocab RPG game is awesome, thanks btw. When RPGing on iOS, the default apostrophe key on the English keyboard doesn't register as the "correct" one. Example for won't here.

When entering the neutral vertical apostrophe via long-press in iOS, the answer is validated as correct.

I'm never worked in typescript but is possible to wrap either the answer value or input value with a function that fixes weird apostrophe entries?

        // Setup answer input
        const answer = this.add.dom(x, VocabRPGGame.HEIGHT - 30).createFromCache("answer_input")
        const answerField = document.getElementById("answerField") as HTMLInputElement
        const checkAnswer = () => {
            const input: string = answerField.value.trim()
            if (!input) return

            // Check the answer
            let correct = false
            if (Array.isArray(this.word.en)) {
                // There's multiple correct answers, see if it matches any of them
                if (this.word.en.includes(input)) correct = true
            } else if (this.word.en == input) {
                correct = true
            }

The apostrophe in the Japanese keyboard is oddly slanted -- maybe this trips the validation function also.

earthiverse commented 2 years ago

I have added a few character replacements in 944b6d633cdd0725d187cba0d64330546530fe8f.

The changes should be live, let me know if there are still problems 🙂

buscandoaverroes commented 2 years ago

Awesome, thanks!