spanish-quizzer

An app to quiz you on Spanish vocabulary and verb conjugations
git clone https://git.ashermorgan.net/spanish-quizzer/
Log | Files | Refs | README

commit 093054fb151b9a697ad4429988824b70bf79612f
parent c2483b7b5bba6432f75f8b830e0948a7cf309a9e
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date:   Sat,  5 Sep 2020 18:14:46 -0700

Implement getLang method.

Diffstat:
MScripts/Home.js | 8++++++++
MScripts/Reference.js | 11+++++++++++
Mindex.html | 4++--
Mreference.html | 2+-
4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/Scripts/Home.js b/Scripts/Home.js @@ -136,6 +136,14 @@ function Load() { // Return filters return filters; + }, + getLang: function(label) { + if (label.toLowerCase().includes("spanish")) { + return "es"; + } + else { + return "en"; + } } }, diff --git a/Scripts/Reference.js b/Scripts/Reference.js @@ -16,6 +16,17 @@ function Load() { query: "" }, + methods: { + getLang: function(label) { + if (label.toLowerCase().includes("spanish")) { + return "es"; + } + else { + return "en"; + } + } + }, + watch: { darkTheme: function() { // Get theme from localStorage if null diff --git a/index.html b/index.html @@ -160,14 +160,14 @@ <p id="quizzerProgress">{{ promptIndex }} / {{ prompts.length}}</p> <section> - <label id="quizzerPromptType" for="quizzerPrompt">{{ prompt[0] }}</label> + <label id="quizzerPromptType" for="quizzerPrompt" :lang="getLang(prompt[0])">{{ prompt[0] }}</label> <span id="quizzerPrompt" @click="Read(prompt[1], prompt[0]);">{{ prompt[1] }}</span> </section> <section> <label id="quizzerInputType" for="quizzerInput">{{ prompt[2] }}</label> <input id="quizzerInput" type="text" v-model="responce" :readonly="!responceActive || inputType == 'Voice'" - @keyup.ctrl.enter.exact="Reset();" @keyup.enter.exact="Enter();" + @keyup.ctrl.enter.exact="Reset();" @keyup.enter.exact="Enter();" :lang="getLang(prompt[2])" autocomplete="off" spellcheck="false" autocorrect="off" placeholder="Type the answer"> </section> diff --git a/reference.html b/reference.html @@ -60,7 +60,7 @@ <table> <tr v-for="(row, rowIndex) in sets[set]" v-show="rowIndex == 0 || row.join(',').toLowerCase().includes(query.toLowerCase())"> <th v-if="rowIndex == 0" v-for="column in row">{{ column }}</th> - <td v-if="rowIndex != 0" v-for="(column, columnIndex) in row" @click="Read(rowIndex, columnIndex)">{{ column }}</td> + <td v-if="rowIndex != 0" v-for="(column, columnIndex) in row" @click="Read(rowIndex, columnIndex)" :lang="getLang(sets[set][0][columnIndex])">{{ column }}</td> </tr> </table> </div>