diff --git a/__init__.py b/__init__.py index 6adc71f8..f8ce3650 100644 --- a/__init__.py +++ b/__init__.py @@ -949,7 +949,7 @@ def _get_intent_data(self, message: Message) -> WeatherIntent: def _get_weather_config(self, message=None): sess = SessionManager.get(message) - cfg = {"lang": sess. lang, + cfg = {"lang": sess.lang, "system_unit": sess.system_unit, "location": sess.location_preferences, "date_format": sess.date_format, diff --git a/weather_helpers/intent.py b/weather_helpers/intent.py index a0b9497a..c0051548 100644 --- a/weather_helpers/intent.py +++ b/weather_helpers/intent.py @@ -91,7 +91,7 @@ def geolocation(self): if self.location is None: self._geolocation = dict() else: - self._geolocation = get_geolocation(self.location) + self._geolocation = get_geolocation(self.location, lang=self.config.lang) return self._geolocation @property diff --git a/weather_helpers/util.py b/weather_helpers/util.py index 925e4030..fa7761b5 100644 --- a/weather_helpers/util.py +++ b/weather_helpers/util.py @@ -18,7 +18,7 @@ import pytz from ovos_date_parser import nice_date, extract_datetime -from ovos_utils.location import get_geolocation as _get_geo +from ovos_utils.geolocation import get_geolocation as _get_geo from ovos_utils.time import now_local, to_local @@ -82,11 +82,12 @@ def get_tz_info(timezone: str) -> tzinfo: return pytz.timezone(timezone) -def get_geolocation(location: str): +def get_geolocation(location: str, lang: str = "en"): """Retrieve the geolocation information about the requested location. Args: location: a location specified in the utterance + lang: lang to return country/region in Returns: A deserialized JSON object containing geolocation information for the @@ -95,7 +96,7 @@ def get_geolocation(location: str): Raises: LocationNotFound error if the API returns no results. """ - geolocation = _get_geo(location) + geolocation = _get_geo(location, lang=lang) if geolocation is None: raise LocationNotFoundError(f"Location {location} is unknown")