Make string translatable
This commit is contained in:
parent
814c4cd3f5
commit
8bb2184818
@ -32,7 +32,7 @@ android {
|
|||||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
targetSdk = libs.versions.targetSdk.get().toInt()
|
||||||
@SuppressLint("HighAppVersionCode")
|
@SuppressLint("HighAppVersionCode")
|
||||||
versionCode = System.getenv("VERSION_CODE_OVERRIDE")?.toIntOrNull() ?: 2024072400
|
versionCode = System.getenv("VERSION_CODE_OVERRIDE")?.toIntOrNull() ?: 2024072400
|
||||||
versionName = "1.32.2"
|
versionName = "1.33.0"
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
signingConfig = signingConfigs.getByName("debug")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.pluralStringResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
@ -125,7 +126,13 @@ fun CalendarSearchSettingsScreen() {
|
|||||||
title = plugin.plugin.label,
|
title = plugin.plugin.label,
|
||||||
enabled = state is PluginState.Ready,
|
enabled = state is PluginState.Ready,
|
||||||
summary = (state as? PluginState.SetupRequired)?.message
|
summary = (state as? PluginState.SetupRequired)?.message
|
||||||
?: if (selectedCalendars != null && calendarLists != null) "$selectedCalendars lists selected"
|
?: if (selectedCalendars != null && calendarLists != null) {
|
||||||
|
pluralStringResource(
|
||||||
|
R.plurals.calendar_search_enabled_lists,
|
||||||
|
selectedCalendars,
|
||||||
|
selectedCalendars
|
||||||
|
)
|
||||||
|
}
|
||||||
else (state as? PluginState.Ready)?.text ?: plugin.plugin.description,
|
else (state as? PluginState.Ready)?.text ?: plugin.plugin.description,
|
||||||
switchValue = enabledProviders.contains(plugin.plugin.authority) && state is PluginState.Ready,
|
switchValue = enabledProviders.contains(plugin.plugin.authority) && state is PluginState.Ready,
|
||||||
onSwitchChanged = {
|
onSwitchChanged = {
|
||||||
|
|||||||
@ -16,8 +16,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.wrapContentHeight
|
|
||||||
import androidx.compose.foundation.layout.wrapContentWidth
|
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
@ -33,12 +31,11 @@ import androidx.compose.material.icons.rounded.Place
|
|||||||
import androidx.compose.material.icons.rounded.Settings
|
import androidx.compose.material.icons.rounded.Settings
|
||||||
import androidx.compose.material.icons.rounded.Today
|
import androidx.compose.material.icons.rounded.Today
|
||||||
import androidx.compose.material.icons.rounded.Verified
|
import androidx.compose.material.icons.rounded.Verified
|
||||||
import androidx.compose.material3.AlertDialogDefaults
|
|
||||||
import androidx.compose.material3.BasicAlertDialog
|
|
||||||
import androidx.compose.material3.CheckboxDefaults
|
import androidx.compose.material3.CheckboxDefaults
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@ -55,6 +52,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.pluralStringResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
@ -471,17 +469,31 @@ fun PluginSettingsScreen(pluginId: String) {
|
|||||||
}
|
}
|
||||||
val calendarLists by remember(plugin.state, plugin.plugin) {
|
val calendarLists by remember(plugin.state, plugin.plugin) {
|
||||||
viewModel.getCalendarLists(plugin.plugin)
|
viewModel.getCalendarLists(plugin.plugin)
|
||||||
}.collectAsStateWithLifecycle(null, minActiveState = Lifecycle.State.RESUMED)
|
}.collectAsStateWithLifecycle(
|
||||||
|
null,
|
||||||
|
minActiveState = Lifecycle.State.RESUMED
|
||||||
|
)
|
||||||
var showDialog by remember { mutableStateOf(false) }
|
var showDialog by remember { mutableStateOf(false) }
|
||||||
val selectedCalendars = remember(excludedCalendars, calendarLists) {
|
val selectedCalendars = remember(excludedCalendars, calendarLists) {
|
||||||
calendarLists?.size?.minus(excludedCalendars.count { it.startsWith(plugin.plugin.authority) })
|
calendarLists?.size?.minus(excludedCalendars.count {
|
||||||
|
it.startsWith(
|
||||||
|
plugin.plugin.authority
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
PreferenceWithSwitch(
|
PreferenceWithSwitch(
|
||||||
title = plugin.plugin.label,
|
title = plugin.plugin.label,
|
||||||
enabled = enabledCalendarSearchPlugins != null && state is PluginState.Ready,
|
enabled = enabledCalendarSearchPlugins != null && state is PluginState.Ready,
|
||||||
summary = (state as? PluginState.SetupRequired)?.message
|
summary = (state as? PluginState.SetupRequired)?.message
|
||||||
?: if (selectedCalendars != null && calendarLists != null) "$selectedCalendars lists selected"
|
?: if (selectedCalendars != null && calendarLists != null) {
|
||||||
else (state as? PluginState.Ready)?.text ?: plugin.plugin.description,
|
pluralStringResource(
|
||||||
|
R.plurals.calendar_search_enabled_lists,
|
||||||
|
selectedCalendars,
|
||||||
|
selectedCalendars
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else (state as? PluginState.Ready)?.text
|
||||||
|
?: plugin.plugin.description,
|
||||||
switchValue = enabledCalendarSearchPlugins?.contains(plugin.plugin.authority) == true && state is PluginState.Ready,
|
switchValue = enabledCalendarSearchPlugins?.contains(plugin.plugin.authority) == true && state is PluginState.Ready,
|
||||||
onSwitchChanged = {
|
onSwitchChanged = {
|
||||||
viewModel.setCalendarSearchPluginEnabled(
|
viewModel.setCalendarSearchPluginEnabled(
|
||||||
@ -495,16 +507,10 @@ fun PluginSettingsScreen(pluginId: String) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (showDialog && calendarLists?.isNotEmpty() == true) {
|
if (showDialog && calendarLists?.isNotEmpty() == true) {
|
||||||
BasicAlertDialog(
|
ModalBottomSheet(
|
||||||
onDismissRequest = {
|
onDismissRequest = {
|
||||||
showDialog = false
|
showDialog = false
|
||||||
},
|
},
|
||||||
) {
|
|
||||||
Surface(
|
|
||||||
modifier = Modifier.wrapContentWidth()
|
|
||||||
.wrapContentHeight(),
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
tonalElevation = AlertDialogDefaults.TonalElevation
|
|
||||||
) {
|
) {
|
||||||
LazyColumn {
|
LazyColumn {
|
||||||
items(calendarLists!!) {
|
items(calendarLists!!) {
|
||||||
@ -535,7 +541,6 @@ fun PluginSettingsScreen(pluginId: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (weatherPlugins.isNotEmpty()) {
|
if (weatherPlugins.isNotEmpty()) {
|
||||||
PreferenceCategory(
|
PreferenceCategory(
|
||||||
stringResource(R.string.plugin_type_weather),
|
stringResource(R.string.plugin_type_weather),
|
||||||
|
|||||||
@ -998,4 +998,8 @@
|
|||||||
<string name="profile_private_profile_action_unlock">Unlock</string>
|
<string name="profile_private_profile_action_unlock">Unlock</string>
|
||||||
<string name="profile_private_profile_action_lock">Lock private space</string>
|
<string name="profile_private_profile_action_lock">Lock private space</string>
|
||||||
<string name="hint_drag_and_drop_reorder">Hold and drag items to rearrange them</string>
|
<string name="hint_drag_and_drop_reorder">Hold and drag items to rearrange them</string>
|
||||||
|
<plurals name="calendar_search_enabled_lists">
|
||||||
|
<item quantity="one">%1$s list selected</item>
|
||||||
|
<item quantity="other">%1$s lists selected</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
x
Reference in New Issue
Block a user