61 lines
2.7 KiB
Python
61 lines
2.7 KiB
Python
from enum import Enum
|
|
from time import strftime
|
|
from time import gmtime
|
|
class Language(Enum):
|
|
ENGLISH = 1
|
|
GERMAN = 2
|
|
|
|
class Translater:
|
|
def __init__(self, language):
|
|
self.language = language
|
|
self.dict_german = { "Irrigation": "Bewässerungs",
|
|
"system": "system",
|
|
"Dashboard": "Startseite",
|
|
"irrigation zones": "Bewässerungszonen",
|
|
"blocking times": "Sperrzeiten",
|
|
"system settings": "Systemeinstellungen",
|
|
"Zone": "Zone",
|
|
"state": "Status",
|
|
"operating mode": "Betriebsmodus",
|
|
"actual humidity": "momentane Feuchtigkeit",
|
|
"desired humidity": "gewünschte Feuchtigkeit",
|
|
"switched on": "eingeschaltet",
|
|
"switched off": "ausgeschaltet",
|
|
"turn on": "einschalten",
|
|
"turn off": "ausschalten",
|
|
"manual mode": "Handbetrieb",
|
|
"automatic mode": "Automatikbetrieb",
|
|
"switch to manual mode": "Auf Handbetrieb umstellen",
|
|
"switch to automatic mode": "Auf Automatikbetrieb umstellen",
|
|
"minutes": "Minuten",
|
|
"until": "bis",
|
|
"irrigation is planed.": "Bewässerung ist geplant.",
|
|
"planed irrigationjobs": "geplante Bewässerungsaufträge",
|
|
"planed duration": "geplante Dauer",
|
|
"cancel": "abbrechen",
|
|
"delete": "löschen",
|
|
"delete all jobs" : "alle Aufträge löschen",
|
|
"switch all to" : "stelle alle um auf",
|
|
}
|
|
|
|
|
|
def getTranslation(self, english_String):
|
|
match self.language:
|
|
case Language.ENGLISH:
|
|
return english_String
|
|
case Language.GERMAN:
|
|
return self.dict_german[english_String]
|
|
case _:
|
|
return "no translations for these language"
|
|
|
|
def formatTime(self, timeInt):
|
|
format = ""
|
|
match self.language:
|
|
case Language.ENGLISH:
|
|
format = "%I.%S %p"
|
|
case Language.GERMAN:
|
|
format = "%H:%M:%S"
|
|
case _:
|
|
format = ""
|
|
return strftime(format, gmtime(timeInt))
|