Skip to content

Commit

Permalink
add all the modes/speeds defined in Tuya
Browse files Browse the repository at this point in the history
  • Loading branch information
rikman122 committed Jun 17, 2021
1 parent ea24cd1 commit 161775f
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions tuya-vacuum-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,28 +281,46 @@
customElements.define('tuya-vacuum-card', TuyaVacuumCard);
})(window.LitElement || Object.getPrototypeOf(customElements.get("hui-masonry-view") || customElements.get("hui-view")));

const modes = {
const translations = {
en: {
smart: "Smart",
standby: "Standby",
chargego: "Go Charge",
wall_follow: "Wall Follow",
spiral: "Spiral",
left_spiral: "Left Spiral",
right_spiral: "Right Spiral",
right_bow: "Right Bow",
left_bow: "Left Bow",
partial_bow: "Partial Bow",
single: "Spot",
mop: "Mop",
gentle: "Low",
low: "Low",
normal: "Normal",
high: "High"
quiet: "Quiet",
high: "High",
strong: "High"
},
es: {
smart: "Inteligente",
standby: "Reposo",
chargego: "Cargar",
wall_follow: "Rodapies",
spiral: "Espiral",
left_spiral: "Espiral Izquierda",
right_spiral: "Espiral Derecha",
right_bow: "Arco Derecha",
left_bow: "Arco Izquierda",
partial_bow: "Arco Parcial",
single: "Punto",
mop: "Fregar",
gentle: "Bajo",
low: "Bajo",
normal: "Medio",
high: "Alto"
quiet: "Silencioso",
high: "Alto",
strong: "Alto"
},
};

Expand All @@ -314,13 +332,13 @@ function localize(string, search = undefined, replace = undefined) {
.replace("-", "_");

try {
translated = modes[lang][string];
translated = translations[lang][string];
} catch (e) {
translated = modes["en"][string];
translated = translations["en"][string];
}

if (translated === undefined) {
translated = modes["en"][string];
translated = translations["en"][string];
}

if (search !== undefined && replace !== undefined) {
Expand Down

0 comments on commit 161775f

Please sign in to comment.