feat: added russian translations

This commit is contained in:
2026-06-15 17:18:36 +03:00
parent 5cf7e2b7b2
commit 36abc10972
9 changed files with 133 additions and 94 deletions
@@ -24,7 +24,7 @@ import kotlinx.serialization.json.Json
import ru.omni_devel.cards.ui.theme.OmniCardsTheme
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import kotlinx.serialization.decodeFromString
import androidx.compose.ui.res.stringResource
class BackupActivity : ComponentActivity() {
private lateinit var db: DbHelper
@@ -65,12 +65,12 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
context.contentResolver.openOutputStream(it)?.use { outputStream ->
outputStream.write(jsonData.toByteArray())
Toast.makeText(context, "Backup successfully saved", Toast.LENGTH_SHORT).show()
Toast.makeText(context, context.getString(R.string.backup_successfully_saved), Toast.LENGTH_SHORT).show()
activityContext!!.finish()
}
} catch (e: Exception) {
Toast.makeText(context, "Failed to save backup: $e", Toast.LENGTH_LONG).show()
Toast.makeText(context, context.getString(R.string.failed_to_save_backup, e), Toast.LENGTH_LONG).show()
}
}
}
@@ -86,8 +86,8 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
if (showImportDialog.value) {
AlertDialog(
title = { Text("Restore backup") },
text = { Text("This will replace existing cards by data from backup file. Continue?") },
title = { Text(stringResource(R.string.ask_do_restore)) },
text = { Text(stringResource(R.string.restore_caution)) },
confirmButton = {
TextButton(
onClick = {
@@ -105,17 +105,17 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
db.clearDatabase()
db.addCards(cards)
Toast.makeText(context, "Data successfully restored from backup", Toast.LENGTH_SHORT).show()
Toast.makeText(context, context.getString(R.string.backup_successfully_restored), Toast.LENGTH_SHORT).show()
activityContext!!.finish()
}
} catch (e: Exception) {
Toast.makeText(context, "Failed to restore data from backup: $e", Toast.LENGTH_LONG).show()
Toast.makeText(context, context.getString(R.string.failed_to_restore_backup, e), Toast.LENGTH_LONG).show()
}
}
}
) {
Text("Yes")
Text(stringResource(R.string.yes))
}
},
dismissButton = {
@@ -124,7 +124,7 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
showImportDialog.value = false
}
) {
Text("No")
Text(stringResource(R.string.no))
}
},
onDismissRequest = { showImportDialog.value = false },
@@ -137,14 +137,14 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
createBackupLauncher.launch("omnicards-backup.json")
}
) {
Text("Backup to file")
Text(stringResource(R.string.do_backup))
}
FullWidthButton(
onClick = {
restoreFromBackupLauncher.launch("application/json")
}
) {
Text("Restore from file")
Text(stringResource(R.string.do_restore))
}
}
}