diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index b78aff75fa0d4e7ba9c732bf0346c5bd0ff86912..259c191fe6514139fd0f07cf697413dfa00aad36 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -37,6 +37,7 @@
android:label="@string/weather">
+
{
+ ACTION_WEATHER_REFRESH,
+ Intent.ACTION_LOCALE_CHANGED -> {
onDisabled(context)
onEnabled(context)
}
diff --git a/android/src/main/kotlin/foundation/e/blissweather/widget/WidgetViewUtils.kt b/android/src/main/kotlin/foundation/e/blissweather/widget/WidgetViewUtils.kt
index fc0e41caa44c72a26feea983cbdcb828a2510ced..369394deb346146169025689fd17b948714bef1f 100644
--- a/android/src/main/kotlin/foundation/e/blissweather/widget/WidgetViewUtils.kt
+++ b/android/src/main/kotlin/foundation/e/blissweather/widget/WidgetViewUtils.kt
@@ -111,9 +111,7 @@ fun RemoteViews.updateWeatherView(
val dayName =
calendar
.apply { set(Calendar.DAY_OF_WEEK, nextDay) }
- .time
- .toString()
- .substring(0, 3)
+ .getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.getDefault())
val dayRes =
context.resources.getIdentifier(
diff --git a/data/src/main/kotlin/foundation/e/blissweather/api/OpenWeatherRepositoryImpl.kt b/data/src/main/kotlin/foundation/e/blissweather/api/OpenWeatherRepositoryImpl.kt
index 39540f51ae89f3fcd6bc90b6272d0c8fde0b924c..be949fbd7d7c78be0b6edcf8661006fe927c56da 100644
--- a/data/src/main/kotlin/foundation/e/blissweather/api/OpenWeatherRepositoryImpl.kt
+++ b/data/src/main/kotlin/foundation/e/blissweather/api/OpenWeatherRepositoryImpl.kt
@@ -15,6 +15,7 @@ import foundation.e.blissweather.models.Units
import foundation.e.blissweather.models.WeatherCity
import foundation.e.blissweather.models.WeatherData
import foundation.e.blissweather.models.WeatherDayResponse
+import java.util.Locale
import javax.inject.Inject
class OpenWeatherRepositoryImpl
@@ -38,33 +39,38 @@ constructor(
}
}
+ private val lang: String
+ get() = Locale.getDefault().language
+
override suspend fun getWeatherByCoords(
coord: Coordinate,
): ApiResult = handleApi {
- baseApi.getWeatherByCoords(coord.lat, coord.lon, apiKey, unit)
+ baseApi.getWeatherByCoords(coord.lat, coord.lon, apiKey, unit, lang)
}
override suspend fun getDaysForecastByCoords(
coord: Coordinate,
): ApiResult = handleApi {
- baseApi.getForecastByCoords(coord.lat, coord.lon, apiKey, unit)
+ baseApi.getForecastByCoords(coord.lat, coord.lon, apiKey, unit, lang)
}
override suspend fun getWeatherByLocationName(
name: String,
- ): ApiResult = handleApi { baseApi.getWeatherByLocationName(name, apiKey, unit) }
+ ): ApiResult = handleApi {
+ baseApi.getWeatherByLocationName(name, apiKey, unit, lang)
+ }
override suspend fun getLocationCoordsByName(
name: String,
limit: Int,
): ApiResult> = handleApi {
- geoApi.getLocationCoordsByName(name, limit, apiKey, unit)
+ geoApi.getLocationCoordsByName(name, limit, apiKey, unit, lang)
}
override suspend fun getLocationNameByCoords(
coord: Coordinate,
limit: Int,
): ApiResult> = handleApi {
- geoApi.getLocationNameByCoords(coord.lat, coord.lon, limit, apiKey, unit)
+ geoApi.getLocationNameByCoords(coord.lat, coord.lon, limit, apiKey, unit, lang)
}
}