diff --git a/README.md b/README.md index 1ea9cd3..2448f6c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/action-owm.py b/action-owm.py index da7101a..c5fdda5 100755 --- a/action-owm.py +++ b/action-owm.py @@ -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"], diff --git a/snipsowm/feedback/sentence_generator.py b/snipsowm/feedback/sentence_generator.py index 68096d1..5c398fb 100644 --- a/snipsowm/feedback/sentence_generator.py +++ b/snipsowm/feedback/sentence_generator.py @@ -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": "Da ist was schiefgelaufen beim Wetterdaten einlesen, versuche es bitte nochmal" } return error_sentences[self.locale] @@ -31,7 +32,8 @@ def generate_error_locale_sentence(self): error_sentences = { "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." + "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": "Da ist was schiefgelaufen: Auf dem System ist nicht die richtige Lokalisierung installiert ('locale'). Bitte prüfen Sie die Dokumentation." } return error_sentences[self.locale] @@ -40,7 +42,8 @@ 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 proporcionada no es válida, por favor comprueba tu fichero config.ini" + "es_ES": "La clave de la API proporcionada no es válida, por favor comprueba tu fichero config.ini", + "de_DE": "Der eingetragene API-Schlüssel ist ungültig, bitte prüfe die Konfigurationsdatei" } return error_sentences[self.locale] @@ -79,6 +82,11 @@ def generate_sentence_introduction(self, tone): AnswerSentenceGenerator.SentenceTone.POSITIVE: "Sí,", AnswerSentenceGenerator.SentenceTone.NEGATIVE: "No,", AnswerSentenceGenerator.SentenceTone.NEUTRAL: "" + }, + "de_DE": { + AnswerSentenceGenerator.SentenceTone.POSITIVE: "Ja,", + AnswerSentenceGenerator.SentenceTone.NEGATIVE: "Nein,", + AnswerSentenceGenerator.SentenceTone.NEUTRAL: "" } } @@ -149,6 +157,13 @@ def generate_sentence_locality(self, POI=None, Locality=None, Region=None, Count else: return "" + elif 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 "" @@ -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 nicht die richtigen Daten für den angegebenen Ort und Zeit finden" } if (temperature is None): @@ -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": ["Es wird {} Grad"] } introduction = random.choice(sentence_introductions[self.locale]).format(temperature) diff --git a/snipsowm/sentence_generator.py b/snipsowm/sentence_generator.py index c5e30ad..31939cb 100644 --- a/snipsowm/sentence_generator.py +++ b/snipsowm/sentence_generator.py @@ -77,6 +77,11 @@ def generate_sentence_introduction(self, tone): SentenceTone.POSITIVE: "Sí,", SentenceTone.NEGATIVE: "No,", SentenceTone.NEUTRAL: "" + }, + "es_ES": { + SentenceTone.POSITIVE: "Ja,", + SentenceTone.NEGATIVE: "Nein,", + SentenceTone.NEUTRAL: "" } } @@ -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 "" @@ -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 nicht die richtigen Daten für den angegebenen Ort und das datum finden" } if (temperature is None): @@ -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 sein", "Es wird {} Grad"] } introduction = random.choice(sentence_introductions[self.locale]).format(temperature) @@ -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 meteorológica, por favor inténtalo de nuevo", + "de_DE": "Da ist was schiefgelaufen beim Wetterdaten einlesen, versuche es bitte nochmal" } return error_sentences[self.locale] @@ -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 proporcionada no es válida, por favor comprueba tu fichero config.ini", + "de_DE": "Der eingetragene API-Schlüssel ist ungültig, bitte prüfe die Konfigurationsdatei" } return error_sentences[self.locale] \ No newline at end of file diff --git a/snipsowm/snips.py b/snipsowm/snips.py index a5f2c2a..e3d49b8 100644 --- a/snipsowm/snips.py +++ b/snipsowm/snips.py @@ -60,262 +60,315 @@ class SnipsWeatherConditions(Enum): mappings = { SnipsWeatherConditions.HUMID: { + 'de_DE': [u'feucht'], 'fr_FR': [u'humide'], 'en_US': [u'humid'], 'es_ES': [u'húmedo'] }, SnipsWeatherConditions.BLIZZARD: { + 'de_DE': [u'blizzard'], 'fr_FR': [u'blizzard'], 'en_US': [u'blizzard'], 'es_ES': [u'ventisca'] }, SnipsWeatherConditions.SNOWFALL: { + 'de_DE': [u'schneefall'], 'fr_FR': [u'chutes de neige'], 'en_US': [u'snowfall'], 'es_ES': [u'nieve'] }, SnipsWeatherConditions.WINDY: { + 'de_DE': [u'windig'], 'fr_FR': [u'venteux'], 'en_US': [u'windy'], 'es_ES': [u'viento'] }, SnipsWeatherConditions.CLOUD: { + 'de_DE': [u'wolken'], 'fr_FR': [u'nuage', u'nuages'], 'en_US': [u'cloud', u'clouds'], 'es_ES': [u'nuboso'] }, SnipsWeatherConditions.RAINY: { + 'de_DE': [u'regnerisch'], 'fr_FR': [u'pluvieux'], 'en_US': [u'rainy'], 'es_ES': [u'lluvioso'] }, SnipsWeatherConditions.STORMY: { + 'de_DE': [u'stürmisch'], 'fr_FR': [u'orageux'], 'en_US': [u'stormy'], 'es_ES': [u'tormentoso'] }, SnipsWeatherConditions.SUN: { + 'de_DE': [u'sonne'], 'fr_FR': [u'soleil'], 'en_US': [u'sun'], 'es_ES': [u'soleado'] }, SnipsWeatherConditions.SNOW: { + 'de_DE': [u'schnee'], 'fr_FR': [u'neige', u'neiger', u'neigera'], 'en_US': [u'snow'], 'es_ES': [u'nieve'] }, SnipsWeatherConditions.FOG: { + 'de_DE': [u'nebel'], 'fr_FR': [u'brouillard'], 'en_US': [u'fog'], 'es_ES': [u'niebla'] }, SnipsWeatherConditions.DEPRESSION: { + 'de_DE': [u'tiefdruck'], 'fr_FR': [u'dépression'], 'en_US': [u'depression'], 'es_ES': [u'depresión'] }, SnipsWeatherConditions.STORM: { + 'de_DE': [u'sturm'], 'fr_FR': [u'tempête'], 'en_US': [u'storm'], 'es_ES': [u'tormenta'] }, SnipsWeatherConditions.RAINFALL: { + 'de_DE': [u'regen'], 'fr_FR': [u'précipitations'], 'en_US': [u'rainfall'], 'es_ES': [u'precipitaciones'] }, SnipsWeatherConditions.SNOWY: { + 'de_DE': [u'verschneit'], 'fr_FR': [u'neigeux'], 'en_US': [u'snowy'], 'es_ES': [u'nevada'] }, SnipsWeatherConditions.SUNNY: { + 'de_DE': [u'sonnig'], 'fr_FR': [u'ensoleillé'], 'en_US': [u'sunny'], 'es_ES': [u'soleado'] }, SnipsWeatherConditions.RAIN: { + 'de_DE': [u'regen'], 'fr_FR': [u'pluie'], 'en_US': [u'rain'], 'es_ES': [u'lluvia'] }, SnipsWeatherConditions.HAIL: { + 'de_DE': [u'hagel'], 'fr_FR': [u'grêle'], 'en_US': [u'hail'], 'es_ES': [u'granizo'] }, SnipsWeatherConditions.FOGGY: { + 'de_DE': [u'nebelich'], 'fr_FR': [u'brumeux'], 'en_US': [u'foggy'], 'es_ES': [u'nebuloso'] }, SnipsWeatherConditions.OVERCAST: { + 'de_DE': [u'bewölkt'], 'fr_FR': [u'couvert'], 'en_US': [u'overcast'], 'es_ES': [u'cubierto'] }, SnipsWeatherConditions.CLOUDY: { + 'de_DE': [u'wolkig'], 'fr_FR': [u'nuageux'], 'en_US': [u'cloudy'], 'es_ES': [u'nublado'] }, SnipsWeatherConditions.HUMIDITY: { + 'de_DE': [u'feuchte'], 'fr_FR': [u'humidité'], 'en_US': [u'humidity'], 'es_ES': [u'humedad'] }, SnipsWeatherConditions.SNOWSTORM: { + 'de_DE': [u'schneesturm'], 'fr_FR': [u'tempête de neige'], 'en_US': [u'snowstorm'], 'es_ES': [u'tormenta de nieve'] }, SnipsWeatherConditions.WIND: { + 'de_DE': [u'wind'], 'fr_FR': [u'vent'], 'en_US': [u'wind'], 'es_ES': [u'viento'] }, SnipsWeatherConditions.TRENCH_COAT: { + 'de_DE': [u'mantel'], 'fr_FR': [u'trench'], 'en_US': [u'trench coat'], 'es_ES': [u'gabardina'] }, SnipsWeatherConditions.PARKA: { + 'de_DE': [u'anorak'], 'fr_FR': [u'parka'], 'en_US': [u'parka'], 'es_ES': [u'anorak'] }, SnipsWeatherConditions.CARDIGAN: { + 'de_DE': [u'strickjacke'], 'fr_FR': [u'cardigan'], 'en_US': [u'cardigan'], 'es_ES': [u'chaqueta'] }, SnipsWeatherConditions.SUMMER_CLOTHING: { + 'de_DE': [u'sommerkleidung'], 'fr_FR': [u'légé'], 'en_US': [u'summer clothing'], 'es_ES': [u'ropa de verano'] }, SnipsWeatherConditions.GAMP: { + 'de_DE': [u'regenschirm'], 'fr_FR': [u'parapluie'], 'en_US': [u'gamp'], 'es_ES': [u'paraguas'] }, SnipsWeatherConditions.BROLLY: { + 'de_DE': [u'regenschirm'], 'fr_FR': [u'parapluie'], 'en_US': [u'brolly'], 'es_ES': [u'paraguas'] }, SnipsWeatherConditions.SUNSHADE: { + 'de_DE': [u'sonnenschirm'], 'fr_FR': [u'parasol'], 'en_US': [u'sunshade'], 'es_ES': [u'sombrilla'] }, SnipsWeatherConditions.PARASOL: { + 'de_DE': [u'sonnenschirm'], 'fr_FR': [u'parasol'], 'en_US': [u'parasol'], 'es_ES': [u'sombrilla'] }, SnipsWeatherConditions.UMBRELLA: { + 'de_DE': [u'regenschirm'], 'fr_FR': [u'parapluie'], 'en_US': [u'umbrella'], 'es_ES': [u'paraguas'] }, SnipsWeatherConditions.OPEN_TOED_SHOES: { + 'de_DE': [u'sandalen'], 'fr_FR': [u'sandales'], 'en_US': [u'open toed shoes'], 'es_ES': [u'sandalias'] }, SnipsWeatherConditions.SHORTS: { + 'de_DE': [u'kurze hosen'], 'fr_FR': [u'short'], 'en_US': [u'shorts'], 'es_ES': [u'pantalones cortos'] }, SnipsWeatherConditions.SKIRT: { + 'de_DE': [u'rock'], 'fr_FR': [u'jupe'], 'en_US': [u'skirt'], 'es_ES': [u'falda'] }, SnipsWeatherConditions.WARM_JUMPER: { + 'de_DE': [u'pulli'], 'fr_FR': [u'jupe courte'], 'en_US': [u'warm jumper'], 'es_ES': [u'jersey cálido'] }, SnipsWeatherConditions.WARM_SOCKS: { + 'de_DE': [u'warme socken'], 'fr_FR': [u'chausettes chaudes'], 'en_US': [u'warm socks'], 'es_ES': [u'calcetines cálidos'] }, SnipsWeatherConditions.WARM_SWEATER: { + 'de_DE': [u'pullover'], 'fr_FR': [u'pull'], 'en_US': [u'warm sweater'], 'es_ES': [u'jersey cálido'] }, SnipsWeatherConditions.SCARF: { + 'de_DE': [u'schal'], 'fr_FR': [u'écharpe'], 'en_US': [u'scarf'], 'es_ES': [u'bufanda'] }, SnipsWeatherConditions.STRAW_HAT: { + 'de_DE': [u'strohhut'], 'fr_FR': [u'chapeau de paille'], 'en_US': [u'straw hat'], 'es_ES': [u'sombero de paja'] }, SnipsWeatherConditions.HAT: { + 'de_DE': [u'hut'], 'fr_FR': [u'chapeau'], 'en_US': [u'hat'], 'es_ES': [u'sombrero'] }, SnipsWeatherConditions.SUNBLOCK: { + 'de_DE': [u'sonnencreme'], 'fr_FR': [u'crème solaire'], 'en_US': [u'sunblock'], 'es_ES': [u'crema solar'] }, SnipsWeatherConditions.SUNSCREEN: { + 'de_DE': [u'sonnenschutz'], 'fr_FR': [u'écran solaire'], 'en_US': [u'sunscreen'], 'es_ES': [u'protector solar'] }, SnipsWeatherConditions.SUN_CREAM: { + 'de_DE': [u'sonnencreme'], 'fr_FR': [u'crème solaire'], 'en_US': [u'sun cream'], 'es_ES': [u'crema solar'] }, SnipsWeatherConditions.WOOLEN_SWEATER: { + 'de_DE': [u'wollpullover'], 'fr_FR': [u'pull en laine'], 'en_US': [u'woolen sweater'], 'es_ES': [u'jersey de lana'] }, SnipsWeatherConditions.WOOLEN_JUMPER: { + 'de_DE': [u'pullover'], 'fr_FR': [u'pull en laine'], 'en_US': [u'woolen jumper'], 'es_ES': [u'jersey de lana'] }, SnipsWeatherConditions.WOOLEN_TIGHTS: { + 'de_DE': [u'strumpfhosen'], 'fr_FR': [u'collants en laine'], 'en_US': [u'woolen tights'], 'es_ES': [u'medias de lana'] }, SnipsWeatherConditions.SLEEVELESS_SUNDRESS: { + 'de_DE': [u'sommerkleidung'], 'fr_FR': [u'robe d\'été'], 'en_US': [u'sleeveless sundress'], 'es_ES': [u'vestido sin mangas'] }, SnipsWeatherConditions.SUNDRESS: { + 'de_DE': [u'sommerkleidung'], 'fr_FR': [u'robe d\'été'], 'en_US': [u'sundress'], 'es_ES': [u'vestido de verano'] }, SnipsWeatherConditions.CHUNKY_SWEATER: { + 'de_DE': [u'pullover'], 'fr_FR': [u'gros pull'], 'en_US': [u'chunky sweater'], 'es_ES': [u'jersey grueso'] }, SnipsWeatherConditions.SUNGLASSES: { + 'de_DE': [u'sonnenbrille'], 'fr_FR': [u'lunettes de soleil'], 'en_US': [u'sunglasses'], 'es_ES': [u'gafas de sol'] }, SnipsWeatherConditions.RAINCOAT: { + 'de_DE': [u'regenjacke'], 'fr_FR': [u'manteau pour la pluie'], 'en_US': [u'raincoat'], 'es_ES': [u'impermeable'] }, SnipsWeatherConditions.WOOLEN_SOCKS: { + 'de_DE': [u'wollsocken'], 'fr_FR': [u'chaussettes en laine'], 'en_US': [u'woolen socks'], 'es_ES': [u'calcetines de lana'] diff --git a/snipsowm/weather_condition.py b/snipsowm/weather_condition.py index ebc3743..32a6a64 100644 --- a/snipsowm/weather_condition.py +++ b/snipsowm/weather_condition.py @@ -17,56 +17,67 @@ def __init__(self, key): descriptions = { WeatherConditions.THUNDERSTORM: { + "de_DE": ["voraussichtlich Gewitterstürme"], "en_US": ["Thunderstorms are expected", "expect thunderstorms"], "fr_FR": ["de l'orage et des éclair sont prévus"], "es_ES": ["Se esperan tormentas"], }, WeatherConditions.DRIZZLE: { + "de_DE": ["voraussichtlich Nieselregen"], "en_US": ["drizzle are expected", "expect drizzle"], "fr_FR": ["prévoir de la bruine"], "es_ES": ["Se espera granizo"], }, WeatherConditions.RAIN: { + "de_DE": ["voraussichtlich regen"], "en_US": ["rain is expected", "it's going to be rainy", "expect rain"], "fr_FR": ["il va pleuvoir", "il pleuvra", "le temps sera pluvieux"], "es_ES": ["Se esperan lluvias"], }, WeatherConditions.SNOW: { + "de_DE": ["voraussichtlich Schnee"], "en_US": ["snow is expected", "it's going to snow", "expect snow"], "fr_FR": ["il neigera", "il va neiger", "le temps sera neigeux"], "es_ES": ["Se esperan nevadas"], }, WeatherConditions.FOG: { + "de_DE": ["voraussichtlich Nebel"], "en_US": ["fog is expected", "it's going to be foggy", "expect fog"], "fr_FR": ["Il y aura du brouillard"], "es_ES": ["Se espera niebla"], }, WeatherConditions.SUN: { + "de_DE": ["Sonnenschein", "voraussichtlich sonnig"], "en_US": ["sun is expected", "it's going to be sunny", "the sun will shine"], "fr_FR": ["le temps sera ensoleillé"], "es_ES": ["Se espera sol", "El sol brillará"], }, WeatherConditions.CLOUDS: { + "de_DE": ["voraussichtlich wolkig"], "en_US": ["it's going to be cloudy", "expect clouds"], "fr_FR": ["le temps sera nuageux"], "es_ES": ["Se esperan nubes", "El cielo estará nublado"], }, WeatherConditions.STORM: { + "de_DE": ["voraussichtlich stürmisch"], "en_US": ["storms are expected", "it's going to be stormy", "expect storms"], "fr_FR": ["il y aura de l'orage"], "es_ES": ["Se esperan tormentas"], }, WeatherConditions.HUMID: { + "de_DE": ["voraussichtlich hohe Luftfeuchtigkeit"], "en_US": ["humidity is expected", "it's going to be humid"], "fr_FR": ["le temps sera humide"], "es_ES": ["La humedad será elevada"], }, WeatherConditions.WIND: { + "de_DE": ["voraussichtlich windig"], "en_US": ["wind is expected", "it's going to be windy", "expect wind"], "fr_FR": ["s'attendre à du vent"], "es_ES": ["Se espera un tiempo ventoso"], }, WeatherConditions.UNKNOWN: { + "de_DE": ["Unbekannte Wetterbedingungen"], "en_US": ["I don't know how to describe the weather"], "fr_FR": ["Je ne peux pas décrire la météo"], "es_ES": ["No puedo decirte el tiempo que hará"],