Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add german translation #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ To have the skills properly working, you **need** to generate locales for your l
- 🇺🇸 `en_US`
- 🇫🇷 `fr_FR`
- 🇪🇸 `es_ES`
- 🇩🇪 `de_DE`

You can generate them with `sudo raspi-config`. Going in the `Localisation Options` submenu, then in the `Change Locale` submenu, and selecting the locales you want to support. For instance, select `en_US UTF-8` if you want support for English.

Expand Down
2 changes: 1 addition & 1 deletion action-owm.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def searchWeatherForecastItem(hermes, intent_message):

if skill_locale == u"":
print "No locale information is found!"
print "Please edit 'config.ini' file, give either en_US, fr_FR or es_ES refering to the language of your assistant"
print "Please edit 'config.ini' file, give either en_US, fr_FR, de_DE or es_ES refering to the language of your assistant"
sys.exit(1)

skill = SnipsOWM(config["secret"]["api_key"],
Expand Down
23 changes: 20 additions & 3 deletions snipsowm/feedback/sentence_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def generate_error_sentence(self):
error_sentences = {
"en_US": "An error occured when trying to retrieve the weather, please try again",
"fr_FR": "Désolé, il y a eu une erreur lors de la récupération des données météo. Veuillez réessayer",
"es_ES": "Ha ocurrido un error obteniendo la información meteorológica, por favor inténtalo de nuevo"
"es_ES": "Ha ocurrido un error obteniendo la información meteorológica, por favor inténtalo de nuevo",
"de_DE": "Beim abrufen des Wetters ist ein Fehler aufgetreten, bitte versuche es erneut"
}

return error_sentences[self.locale]
Expand All @@ -32,6 +33,7 @@ def generate_error_locale_sentence(self):
"en_US": "An error occured. Your system doesn't have the correct locale installed. Please refer to the documentation. ",
"fr_FR": "Désolé, il y a eu une erreur. Votre système n'a pas la locale correcte installée. Veuillez consulter la documentation pour plus de détails.",
"es_ES": "Ha ocurrido un error. Parece que el sistema no tiene instalado el paquete de idioma correcto ('locale'). Consula la documentación para más detalles."
"de_DE": "Ein Fehler ist aufgetreten. Es ist die falsche Sprache konfiguriert. Wirf einen Blick in die Dokumentation"
}

return error_sentences[self.locale]
Expand All @@ -41,6 +43,7 @@ def generate_api_key_error_sentence(self):
"en_US": "The API key you provided is invalid, check your config.ini",
"fr_FR": "La clé API fournie est incorrecte, vérifiez le fichier config.ini",
"es_ES": "La clave de la API proporcionada no es válida, por favor comprueba tu fichero config.ini"
"de_DE": "Der API Schlüssel, den du bereitgestellt hast, ist nicht gültig. Überprüfe deine config.ini"
}
return error_sentences[self.locale]

Expand Down Expand Up @@ -80,6 +83,11 @@ def generate_sentence_introduction(self, tone):
AnswerSentenceGenerator.SentenceTone.NEGATIVE: "No,",
AnswerSentenceGenerator.SentenceTone.NEUTRAL: ""
}
"de_DE": {
AnswerSentenceGenerator.SentenceTone.POSITIVE: "Ja,",
AnswerSentenceGenerator.SentenceTone.NEGATIVE: "Nein,",
AnswerSentenceGenerator.SentenceTone.NEUTRAL: ""
}
}

sentence_beginning = sentence_beginnings[self.locale][tone]
Expand Down Expand Up @@ -149,6 +157,13 @@ def generate_sentence_locality(self, POI=None, Locality=None, Region=None, Count
else:
return ""

if self.locale == "de_DE":
if POI or Locality or Region or Country:
locality = filter(lambda x: x is not None, [POI, Locality, Region, Country])[0]
return "in {}".format(locality)
else:
return ""

else:
return ""

Expand Down Expand Up @@ -243,7 +258,8 @@ def generate_temperature_sentence(self,
error_sentences = {
"en_US": "I couldn't fetch the right data for the specified place and date",
"fr_FR": "Je n'ai pas pu récupérer les prévisions de température pour cet endroit et ces dates",
"es_ES": "No he podido encontrar información meteorológica para el lugar y la fecha especificados"
"es_ES": "No he podido encontrar información meteorológica para el lugar y la fecha especificados",
"de_DE": "Ich konnte die richtigen Daten für den angegebenen Ort und dem Datum nicht herunterladen"
}

if (temperature is None):
Expand All @@ -252,7 +268,8 @@ def generate_temperature_sentence(self,
sentence_introductions = {
"en_US": ["The temperature will be {} degrees"],
"fr_FR": ["La température sera de {} degrés", "Il fera {} degrés"],
"es_ES": ["La temperatura será de {} grados", "Habrá {} grados"]
"es_ES": ["La temperatura será de {} grados", "Habrá {} grados"],
"de_DE": ["Die Temperatur wird {} Grad betragen", "Es wird {} Grad haben"]
}

introduction = random.choice(sentence_introductions[self.locale]).format(temperature)
Expand Down
24 changes: 20 additions & 4 deletions snipsowm/sentence_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ def generate_sentence_introduction(self, tone):
SentenceTone.NEGATIVE: "No,",
SentenceTone.NEUTRAL: ""
}
"de_DE": {
SentenceTone.POSITIVE: "Ja,",
SentenceTone.NEGATIVE: "Nein,",
SentenceTone.NEUTRAL: ""
}
}

sentence_beginning = sentence_beginnings[self.locale][tone]
Expand Down Expand Up @@ -147,6 +152,13 @@ def generate_sentence_locality(self, POI=None, Locality=None, Region=None, Count
else:
return ""

if self.locale == "de_DE":
if POI or Locality or Region or Country:
locality = filter(lambda x: x is not None, [POI, Locality, Region, Country])[0]
return "in {}".format(locality)
else:
return ""

else:
return ""

Expand Down Expand Up @@ -236,7 +248,8 @@ def generate_temperature_sentence(self,
error_sentences = {
"en_US": "I couldn't fetch the right data for the specified place and date",
"fr_FR": "Je n'ai pas pu récupérer les prévisions de température pour cet endroit et ces dates",
"es_ES": "No he podido encontrar información meteorológica para el lugar y la fecha especificados"
"es_ES": "No he podido encontrar información meteorológica para el lugar y la fecha especificados",
"de_DE": "Ich konnte die richtigen Daten für den angegebenen Ort und dem Datum nicht herunterladen"
}

if (temperature is None):
Expand All @@ -245,7 +258,8 @@ def generate_temperature_sentence(self,
sentence_introductions = {
"en_US": ["The temperature will be {} degrees"],
"fr_FR": ["La température sera de {} degrés", "Il fera {} degrés"],
"es_ES": ["La temperatura será de {} grados", "Habrá {} grados"]
"es_ES": ["La temperatura será de {} grados", "Habrá {} grados"],
"de_DE": ["Die Temperatur wird {} Grad betragen", "Es wird {} Grad haben"]
}

introduction = random.choice(sentence_introductions[self.locale]).format(temperature)
Expand All @@ -261,7 +275,8 @@ def generate_error_sentence(self):
error_sentences = {
"en_US": "An error occured when trying to retrieve the weather, please try again",
"fr_FR": "Désolé, il y a eu une erreur lors de la récupération des données météo. Veuillez réessayer",
"es_ES": "Ha ocurrido un error obteniendo la información climática, por favor inténtalo de nuevo"
"es_ES": "Ha ocurrido un error obteniendo la información climática, por favor inténtalo de nuevo",
"de_DE": "Beim abrufen des Wetters ist ein Fehler aufgetreten, bitte versuche es erneut"
}

return error_sentences[self.locale]
Expand All @@ -270,6 +285,7 @@ def generate_api_key_error_sentence(self):
error_sentences = {
"en_US": "The API key you provided is invalid, check your config.ini",
"fr_FR": "La clé API fournie est incorrecte, vérifiez le fichier config.ini",
"es_ES": "La clave de la API es incorrecta, por favor verifica tu fichero config.ini"
"es_ES": "La clave de la API es incorrecta, por favor verifica tu fichero config.ini",
"de_DE": "Der API Schlüssel, den du bereitgestellt hast, ist nicht gültig. Überprüfe deine config.ini"
}
return error_sentences[self.locale]
Loading