improvement: Move more phrases to translatable resources #614

This commit is contained in:
Artem Chepurnyi 2024-10-03 21:46:45 +03:00
parent 6c360905f1
commit f35dd90bf9
4 changed files with 26 additions and 16 deletions

View File

@ -243,12 +243,15 @@
<string name="folder_action_change_name_title">Change name</string>
<string name="folder_action_change_names_title">Change names</string>
<string name="folder_action_merge_title">Merge into…</string>
<string name="folder_action_merge_confirmation_title">Are you sure you want to merge these folders?</string>
<string name="folder_action_create_title">Create a folder</string>
<string name="folder_delete_one_confirmation_title">Delete the folder?</string>
<string name="folder_delete_many_confirmation_title">Delete the folders?</string>
<string name="folder_delete_confirmation_text">This item(s) will be deleted immediately. You can not undo this action.</string>
<string name="ciphers_recently_opened">Recently opened</string>
<string name="ciphers_often_opened">Often opened</string>
<string name="ciphers_history_empty">No history yet</string>
<string name="ciphers_view_details">View details</string>
<string name="ciphers_save_to">Save to</string>
<string name="ciphers_action_add_to_favorites_title">Add to favourites</string>
@ -268,7 +271,10 @@
<string name="ciphers_action_change_passwords_title">Change passwords</string>
<string name="ciphers_action_view_password_history_title">View password history</string>
<string name="ciphers_action_trash_title">Trash</string>
<string name="ciphers_action_trash_confirmation_title">Move to trash?</string>
<string name="ciphers_action_trash_confirmation_text">Items that have been in Trash more than 30 days will be automatically deleted.</string>
<string name="ciphers_action_restore_title">Restore</string>
<string name="ciphers_action_restore_confirmation_title">Restore from trash?</string>
<string name="ciphers_action_delete_title">Delete forever</string>
<string name="ciphers_action_delete_confirmation_title">Delete forever?</string>
<string name="ciphers_action_configure_watchtower_alerts_title">Configure Watchtower alerts</string>

View File

@ -157,7 +157,7 @@ fun foldersScreenState(
}
?.id
fun onAdd() {
suspend fun onAdd() {
accountId
?: // Should not happen, we should not
// call this function if the account id
@ -166,11 +166,11 @@ fun foldersScreenState(
val intent = createConfirmationDialogIntent(
item = ConfirmationRoute.Args.Item.StringItem(
key = "name",
title = "Folder name",
title = translate(Res.string.generic_name),
// Folder must have a non-empty name!
canBeEmpty = false,
),
title = "Create a folder",
title = translate(Res.string.folder_action_create_title),
) { name ->
val accountIdsToNames = mapOf(
AccountId(accountId) to name,
@ -218,7 +218,7 @@ fun foldersScreenState(
navigate(intent)
}
fun onMerge(
suspend fun onMerge(
folderName: String,
folderIds: Set<String>,
) {
@ -226,7 +226,7 @@ fun foldersScreenState(
val folderNameItem = ConfirmationRoute.Args.Item.StringItem(
key = folderNameKey,
value = folderName,
title = "Folder name",
title = translate(Res.string.generic_name),
type = ConfirmationRoute.Args.Item.StringItem.Type.Text,
canBeEmpty = false,
)
@ -235,7 +235,7 @@ fun foldersScreenState(
route = ConfirmationRoute(
args = ConfirmationRoute.Args(
icon = icon(Icons.Outlined.Merge),
title = "Are you sure you want to merge these folders?",
title = translate(Res.string.folder_action_merge_confirmation_title),
items = listOfNotNull(
folderNameItem,
),
@ -382,9 +382,9 @@ fun foldersScreenState(
this += FlatItemAction(
icon = Icons.Outlined.Merge,
title = Res.string.folder_action_merge_title.wrap(),
onClick = ::onMerge
.partially1(folderName)
.partially1(selectedFolderIds),
onClick = onClick {
onMerge(folderName, selectedFolderIds)
},
)
}
}
@ -511,7 +511,9 @@ fun foldersScreenState(
FoldersState(
selection = selection,
content = Loadable.Ok(content),
onAdd = ::onAdd.takeUnless { selection != null || accountId == null },
onAdd = onClick {
onAdd()
}.takeUnless { selection != null || accountId == null },
)
}
}

View File

@ -30,6 +30,7 @@ import androidx.compose.ui.unit.dp
import com.artemchep.keyguard.common.model.DSecret
import com.artemchep.keyguard.common.model.fold
import com.artemchep.keyguard.feature.home.vault.component.VaultListItem
import com.artemchep.keyguard.res.*
import com.artemchep.keyguard.ui.LeMOdelBottomSheet
import com.artemchep.keyguard.ui.Placeholder
import com.artemchep.keyguard.ui.icons.IconBox
@ -38,6 +39,7 @@ import com.artemchep.keyguard.ui.skeleton.SkeletonSegmented
import com.artemchep.keyguard.ui.tabs.SegmentedButtonGroup
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.jetbrains.compose.resources.stringResource
@Composable
fun RecentsButton(
@ -221,7 +223,7 @@ fun ColumnScope.RecentsWindowOk(
) {
Placeholder(
icon = Icons.Outlined.HistoryToggleOff,
title = "No recently opened items yet.",
title = stringResource(Res.string.ciphers_history_empty),
)
}
}

View File

@ -584,15 +584,15 @@ fun RememberStateFlowScope.cipherTrashAction(
FlatItemAction(
leading = icon,
title = title,
onClick = {
onClick = onClick {
before?.invoke()
val route = registerRouteResultReceiver(
route = ConfirmationRoute(
args = ConfirmationRoute.Args(
icon = icon(Icons.Outlined.Delete),
title = "Move to trash?",
message = "Items that have been in Trash more than 30 days will be automatically deleted.",
title = translate(Res.string.ciphers_action_trash_confirmation_title.wrap()),
message = translate(Res.string.ciphers_action_trash_confirmation_text.wrap()),
),
),
) { result ->
@ -630,14 +630,14 @@ fun RememberStateFlowScope.cipherRestoreAction(
FlatItemAction(
leading = icon,
title = title,
onClick = {
onClick = onClick {
before?.invoke()
val route = registerRouteResultReceiver(
route = ConfirmationRoute(
args = ConfirmationRoute.Args(
icon = icon(Icons.Outlined.RestoreFromTrash),
title = "Restore from trash?",
title = translate(Res.string.ciphers_action_restore_confirmation_title.wrap()),
),
),
) { result ->