mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2025-12-05 14:21:55 +00:00
Use Bundle to load string resources
This commit is contained in:
parent
bafad75cea
commit
2a0daaa806
@ -71,11 +71,18 @@ private fun LeftColumn(
|
||||
// TODO Set selected item on initial showing
|
||||
|
||||
Column(modifier) {
|
||||
GroupHeader("My Locations", modifier = Modifier.wrapContentHeight().fillMaxWidth())
|
||||
GroupHeader(
|
||||
ComposeTemplateBundle.message("weather.app.my.locations.header.text"),
|
||||
modifier = Modifier
|
||||
.wrapContentHeight()
|
||||
.fillMaxWidth()
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
val listState = rememberSelectableLazyListState()
|
||||
|
||||
// TODO Check why preselection isn't working
|
||||
LaunchedEffect(myLocations) {
|
||||
listState
|
||||
.selectedKeys = myLocations
|
||||
@ -95,7 +102,6 @@ private fun LeftColumn(
|
||||
items(
|
||||
items = myLocations,
|
||||
key = { item -> item },
|
||||
contentType = { item -> item.location },
|
||||
) { item ->
|
||||
|
||||
ContentItemRow(
|
||||
@ -138,7 +144,7 @@ private fun RightColumn(
|
||||
Column(modifier) {
|
||||
SearchToolbarMenu(
|
||||
searchAutoCompletionItemProvider = searchAutoCompletionItemProvider,
|
||||
confirmButtonText = "Add",
|
||||
confirmButtonText = ComposeTemplateBundle.message("weather.app.search.toolbar.menu.add.button.text"),
|
||||
onSearchPerformed = { place ->
|
||||
weatherViewModelApi.onLoadWeatherForecast(place)
|
||||
},
|
||||
|
||||
@ -54,7 +54,7 @@ internal fun <T> SearchToolbarMenu(
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
Icon(
|
||||
AllIconsKeys.Actions.AddList,
|
||||
contentDescription = ComposeTemplateBundle.message("search.toolbar.menu.add.button.content.description")
|
||||
contentDescription = ComposeTemplateBundle.message("weather.app.search.toolbar.menu.add.button.content.description")
|
||||
)
|
||||
Text(confirmButtonText)
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ import org.jetbrains.jewel.ui.component.HorizontallyScrollableContainer
|
||||
import org.jetbrains.jewel.ui.component.Icon
|
||||
import org.jetbrains.jewel.ui.component.Text
|
||||
import org.jetbrains.jewel.ui.icons.AllIconsKeys
|
||||
import org.jetbrains.plugins.template.ComposeTemplateBundle
|
||||
import org.jetbrains.plugins.template.weatherApp.WeatherAppColors
|
||||
import org.jetbrains.plugins.template.weatherApp.model.DailyForecast
|
||||
import org.jetbrains.plugins.template.weatherApp.model.WeatherForecastData
|
||||
@ -113,7 +114,10 @@ internal fun WeatherDetailsCard(
|
||||
|
||||
// Temperature (emphasized)
|
||||
Text(
|
||||
text = "${currentWeatherForecast.temperature.toInt()}°C",
|
||||
text = ComposeTemplateBundle.message(
|
||||
"weather.app.temperature.text",
|
||||
currentWeatherForecast.temperature.toInt()
|
||||
),
|
||||
color = textColor,
|
||||
fontSize = 32.sp,
|
||||
fontWeight = FontWeight.ExtraBold
|
||||
@ -139,14 +143,21 @@ internal fun WeatherDetailsCard(
|
||||
) {
|
||||
// Wind info
|
||||
Text(
|
||||
text = "Wind: ${currentWeatherForecast.windSpeed.toInt()} km/h ${currentWeatherForecast.windDirection.label}",
|
||||
text = ComposeTemplateBundle.message(
|
||||
"weather.app.wind.direction.text",
|
||||
currentWeatherForecast.windSpeed.toInt(),
|
||||
currentWeatherForecast.windDirection.label
|
||||
),
|
||||
color = textColor,
|
||||
fontSize = 16.sp
|
||||
)
|
||||
|
||||
// Humidity info
|
||||
Text(
|
||||
text = "Humidity: ${currentWeatherForecast.humidity}%",
|
||||
text = ComposeTemplateBundle.message(
|
||||
"weather.app.humidity.text",
|
||||
currentWeatherForecast.humidity
|
||||
),
|
||||
color = textColor,
|
||||
fontSize = 16.sp
|
||||
)
|
||||
@ -176,7 +187,7 @@ private fun SevenDaysForecastWidget(
|
||||
if (weatherForecastData.dailyForecasts.isNotEmpty()) {
|
||||
Column(modifier) {
|
||||
Text(
|
||||
text = "7-Day Forecast",
|
||||
text = ComposeTemplateBundle.message("weather.app.7days.forecast.title.text"),
|
||||
color = textColor,
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
@ -262,7 +273,10 @@ private fun DayForecastItem(
|
||||
|
||||
// Temperature
|
||||
Text(
|
||||
text = "${forecast.temperature.toInt()}°C",
|
||||
text = ComposeTemplateBundle.message(
|
||||
"weather.app.temperature.text",
|
||||
forecast.temperature.toInt()
|
||||
),
|
||||
color = textColor,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
@ -272,7 +286,10 @@ private fun DayForecastItem(
|
||||
|
||||
// Humidity
|
||||
Text(
|
||||
text = "Humidity: ${forecast.humidity}%",
|
||||
text = ComposeTemplateBundle.message(
|
||||
"weather.app.humidity.text",
|
||||
forecast.humidity
|
||||
),
|
||||
color = textColor,
|
||||
fontSize = 12.sp
|
||||
)
|
||||
@ -281,7 +298,11 @@ private fun DayForecastItem(
|
||||
|
||||
// Wind direction
|
||||
Text(
|
||||
text = "Wind: ${forecast.windDirection.label}",
|
||||
text = ComposeTemplateBundle.message(
|
||||
"weather.app.wind.direction.text",
|
||||
forecast.windSpeed.toInt(),
|
||||
forecast.windDirection.label
|
||||
),
|
||||
color = textColor,
|
||||
fontSize = 12.sp
|
||||
)
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
projectService=Project service: {0}
|
||||
randomLabel=The random number is: {0}
|
||||
shuffle=Shuffle
|
||||
helloWorld=Hello world #{0}
|
||||
increment=Moar
|
||||
action.dev.sebastiano.jewel.ijplugin.demo.text=Jewel Demo Dialog
|
||||
|
||||
search.toolbar.menu.add.button.content.description=Add a place to a watch list.
|
||||
weather.app.temperature.text={0}\u00B0C
|
||||
weather.app.humidity.text=Humidity: {0}%
|
||||
weather.app.wind.direction.text=Wind: {0} km/h {1}
|
||||
weather.app.my.locations.header.text=My Locations
|
||||
weather.app.search.toolbar.menu.add.button.text=Add
|
||||
weather.app.search.toolbar.menu.add.button.content.description=Add a place to a watch list.
|
||||
weather.app.7days.forecast.title.text=7-day Forecast
|
||||
Loading…
Reference in New Issue
Block a user