make string translatable

This commit is contained in:
MM20
2026-03-13 15:42:12 +01:00
parent 2f71cbdb50
commit 2404330f97
2 changed files with 5 additions and 3 deletions

View File

@@ -101,6 +101,7 @@ import de.mm20.launcher2.weather.DailyForecast
import de.mm20.launcher2.weather.Forecast
import de.mm20.launcher2.widgets.WeatherWidget
import java.text.SimpleDateFormat
import kotlin.math.roundToInt
@Composable
fun WeatherWidget(widget: WeatherWidget) {
@@ -428,7 +429,7 @@ private fun CurrentWeatherDetails(
contentDescription = null,
tint = MaterialTheme.colorScheme.secondary,
)
} to "UV ${forecast.uvIndex}"
} to resources.getString(R.string.uv_index, forecast.uvIndex?.roundToInt())
)
}
@@ -462,7 +463,7 @@ private fun CurrentWeatherDetails(
)
}
if (size < 4 && forecast.humidity != null) {
if (size < 4 && forecast.humidity != null && forecast.temperature >= 293.15) {
add(
@Composable {
Icon(
@@ -475,7 +476,7 @@ private fun CurrentWeatherDetails(
} to formatPercent(forecast.humidity!!.toFloat()),
)
}
if (size < 4 && forecast.clouds != null && forecast.clouds!! >= 30) {
if (size < 4 && forecast.clouds != null && forecast.clouds!! >= 10) {
add(
@Composable {
Icon(

View File

@@ -88,6 +88,7 @@
<string name="wind_north_west">North west</string>
<!-- Wind direction, used in weather widget -->
<string name="wind_north_north_west">North north west</string>
<string name="uv_index">UV %1$d</string>
<!-- No rain or snow, used in weather widget -->
<!-- The URL of the Wikipedia instance that is used per default. Can be overridden by user.
This should point to the Wikipedia in the given language. If no such Wikipedia exists,