fix: add more translations

This commit is contained in:
particle-box
2026-02-06 09:20:54 +05:30
parent a821cdf85e
commit 6559d4dcd2
4 changed files with 99 additions and 67 deletions

View File

@@ -1177,17 +1177,18 @@ class HomeRootSection : Routes.Route() {
if (showChangelogDialog && latestUpdate != null) { if (showChangelogDialog && latestUpdate != null) {
AestheticDialog( AestheticDialog(
onDismissRequest = { showChangelogDialog = false }, onDismissRequest = { showChangelogDialog = false },
title = "Changelog", title = translation["changelog_dialog_title"],
text = "", text = "",
icon = Icons.Filled.Info, icon = Icons.Filled.Info,
confirmButtonText = "Update", confirmButtonText = translation["changelog_dialog_update_button"],
onConfirm = { onConfirm = {
showChangelogDialog = false showChangelogDialog = false
handleUpdateAction() handleUpdateAction()
}, },
dismissButtonText = "Cancel", dismissButtonText = translation["changelog_dialog_cancel_button"],
onDismiss = { showChangelogDialog = false }, onDismiss = { showChangelogDialog = false },
confirmEnabled = !changelogLoading, confirmEnabled = !changelogLoading,
showCloseButton = false,
customContent = { customContent = {
Column( Column(
modifier = Modifier modifier = Modifier
@@ -1210,7 +1211,7 @@ class HomeRootSection : Routes.Route() {
) )
Spacer(modifier = Modifier.width(10.dp)) Spacer(modifier = Modifier.width(10.dp))
Text( Text(
text = "Loading changelog…", text = translation["changelog_dialog_loading"],
color = Color.White, color = Color.White,
fontWeight = FontWeight.SemiBold fontWeight = FontWeight.SemiBold
) )
@@ -1219,7 +1220,7 @@ class HomeRootSection : Routes.Route() {
changelogError != null -> { changelogError != null -> {
Text( Text(
text = changelogError ?: "Failed to load changelog", text = changelogError ?: translation["changelog_dialog_error"],
color = MaterialTheme.colorScheme.error, color = MaterialTheme.colorScheme.error,
fontWeight = FontWeight.SemiBold fontWeight = FontWeight.SemiBold
) )
@@ -1227,7 +1228,7 @@ class HomeRootSection : Routes.Route() {
else -> { else -> {
Text( Text(
text = changelogText ?: "Changelog not available", text = changelogText ?: translation["changelog_dialog_empty"],
color = PurrfectPalette.textPrimary, color = PurrfectPalette.textPrimary,
fontSize = 14.sp, fontSize = 14.sp,
lineHeight = 20.sp lineHeight = 20.sp
@@ -1242,12 +1243,13 @@ class HomeRootSection : Routes.Route() {
if (showAnnouncementsDialog) { if (showAnnouncementsDialog) {
AestheticDialog( AestheticDialog(
onDismissRequest = { showAnnouncementsDialog = false }, onDismissRequest = { showAnnouncementsDialog = false },
title = "Announcements", title = translation["announcements_dialog_title"],
text = "", text = "",
icon = Icons.Filled.Info, icon = Icons.Filled.Info,
confirmButtonText = "Close", confirmButtonText = translation["announcements_dialog_close_button"],
onConfirm = { showAnnouncementsDialog = false }, onConfirm = { showAnnouncementsDialog = false },
confirmEnabled = !announcementsLoading, confirmEnabled = !announcementsLoading,
showCloseButton = false,
customContent = { customContent = {
Column( Column(
modifier = Modifier modifier = Modifier
@@ -1270,7 +1272,7 @@ class HomeRootSection : Routes.Route() {
) )
Spacer(modifier = Modifier.width(10.dp)) Spacer(modifier = Modifier.width(10.dp))
Text( Text(
text = "Loading announcements...", text = translation["announcements_dialog_loading"],
color = Color.White, color = Color.White,
fontWeight = FontWeight.SemiBold fontWeight = FontWeight.SemiBold
) )
@@ -1279,7 +1281,7 @@ class HomeRootSection : Routes.Route() {
announcementsError != null -> { announcementsError != null -> {
Text( Text(
text = announcementsError ?: "Failed to load announcements", text = announcementsError ?: translation["announcements_dialog_error"],
color = MaterialTheme.colorScheme.error, color = MaterialTheme.colorScheme.error,
fontWeight = FontWeight.SemiBold fontWeight = FontWeight.SemiBold
) )
@@ -1287,7 +1289,7 @@ class HomeRootSection : Routes.Route() {
else -> { else -> {
Text( Text(
text = announcementsText ?: "Announcements not available", text = announcementsText ?: translation["announcements_dialog_empty"],
color = PurrfectPalette.textPrimary, color = PurrfectPalette.textPrimary,
fontSize = 14.sp, fontSize = 14.sp,
lineHeight = 20.sp lineHeight = 20.sp

View File

@@ -16,6 +16,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.OpenInNew import androidx.compose.material.icons.automirrored.filled.OpenInNew
import androidx.compose.material.icons.filled.DeleteSweep import androidx.compose.material.icons.filled.DeleteSweep
import androidx.compose.material.icons.filled.Info
import androidx.compose.material.icons.filled.Tune import androidx.compose.material.icons.filled.Tune
import androidx.compose.material.icons.filled.Warning import androidx.compose.material.icons.filled.Warning
import androidx.compose.material3.* import androidx.compose.material3.*
@@ -314,6 +315,7 @@ class HomeSettings : Routes.Route() {
val scrollState = rememberScrollState() val scrollState = rememberScrollState()
val positiveLabel = context.translation["button.positive"] ?: "Yes" val positiveLabel = context.translation["button.positive"] ?: "Yes"
val negativeLabel = context.translation["button.negative"] ?: "No" val negativeLabel = context.translation["button.negative"] ?: "No"
val importLabel = context.translation["button.import"] ?: "Import"
val sharedButtonColors = ButtonDefaults.buttonColors( val sharedButtonColors = ButtonDefaults.buttonColors(
containerColor = Color.White.copy(alpha = 0.12f), containerColor = Color.White.copy(alpha = 0.12f),
contentColor = Color.White contentColor = Color.White
@@ -378,8 +380,8 @@ class HomeSettings : Routes.Route() {
if (showResetSetupDialog) { if (showResetSetupDialog) {
AestheticDialog( AestheticDialog(
onDismissRequest = { showResetSetupDialog = false }, onDismissRequest = { showResetSetupDialog = false },
title = "Are you sure?", title = translation["reset_setup_dialog_title"],
text = "This will reset PurrfectSnap and restart setup.", text = translation["reset_setup_dialog_text"],
icon = Icons.Filled.Warning, icon = Icons.Filled.Warning,
confirmButtonText = positiveLabel, confirmButtonText = positiveLabel,
dismissButtonText = negativeLabel, dismissButtonText = negativeLabel,
@@ -611,7 +613,7 @@ class HomeSettings : Routes.Route() {
} }
GlassCard { GlassCard {
RowTitle(title = "Reset PurrfectSnap") RowTitle(title = translation["reset_setup_title"])
ShiftedRow( ShiftedRow(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@@ -623,14 +625,14 @@ class HomeSettings : Routes.Route() {
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Text( Text(
text = "Reset and restart setup", text = translation["reset_setup_action"],
fontSize = 16.sp, fontSize = 16.sp,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
lineHeight = 20.sp lineHeight = 20.sp
) )
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.OpenInNew, imageVector = Icons.AutoMirrored.Filled.OpenInNew,
contentDescription = "Reset", contentDescription = translation["reset_setup_action"],
modifier = Modifier.padding(end = 14.dp) modifier = Modifier.padding(end = 14.dp)
) )
} }
@@ -744,7 +746,7 @@ class HomeSettings : Routes.Route() {
colors = sharedButtonColors, colors = sharedButtonColors,
border = BorderStroke(1.dp, Color.White.copy(alpha = 0.12f)) border = BorderStroke(1.dp, Color.White.copy(alpha = 0.12f))
) { ) {
Text(text = "Import") Text(text = translation["import_button"])
} }
} }
} }
@@ -759,53 +761,49 @@ class HomeSettings : Routes.Route() {
Text(translation["view_logger_history_button"]) Text(translation["view_logger_history_button"])
} }
if (showImportDialog) { if (showImportDialog) {
AlertDialog( AestheticDialog(
onDismissRequest = { showImportDialog = false }, onDismissRequest = { showImportDialog = false },
title = { Text("Import message logger") }, title = translation["message_logger_import_title"],
text = { Text("Importing will override your current message logger database. Continue?") }, text = translation["message_logger_import_text"],
confirmButton = { icon = Icons.Filled.Info,
TextButton(onClick = { confirmButtonText = importLabel,
showImportDialog = false dismissButtonText = context.translation["button.cancel"],
runCatching { onConfirm = {
activityLauncherHelper.openFile("application/octet-stream") { uri -> showImportDialog = false
runCatching { runCatching {
context.androidContext.contentResolver.openInputStream(uri.toUri())?.use { inputStream -> activityLauncherHelper.openFile("application/octet-stream") { uri ->
context.messageLogger.databaseFile.outputStream().use { outputStream -> runCatching {
inputStream.copyTo(outputStream) context.androidContext.contentResolver.openInputStream(uri.toUri())?.use { inputStream ->
} context.messageLogger.databaseFile.outputStream().use { outputStream ->
} ?: throw IllegalStateException("Unable to open selected file") inputStream.copyTo(outputStream)
storedMessagesCount = context.messageLogger.getStoredMessageCount() }
storedStoriesCount = context.messageLogger.getStoredStoriesCount() } ?: throw IllegalStateException("Unable to open selected file")
context.shortToast(translation["success_toast"]) storedMessagesCount = context.messageLogger.getStoredMessageCount()
context.log.info("Imported message logger from $uri", "MessageLogger") storedStoriesCount = context.messageLogger.getStoredStoriesCount()
}.onFailure { context.shortToast(translation["success_toast"])
context.log.error("Failed to import message logger", it) context.log.info("Imported message logger from $uri", "MessageLogger")
context.longToast( }.onFailure {
translation.format( context.log.error("Failed to import message logger", it)
"import_failed_toast", context.longToast(
"message" to (it.localizedMessage ?: it.message ?: "") translation.format(
) "import_failed_toast",
"message" to (it.localizedMessage ?: it.message ?: "")
) )
}
}
}.onFailure {
context.log.error("Failed to launch import picker", it)
context.longToast(
translation.format(
"import_failed_toast",
"message" to (it.localizedMessage ?: it.message ?: "")
) )
) }
} }
}) { }.onFailure {
Text(translation["button.import"] ?: "Import") context.log.error("Failed to launch import picker", it)
context.longToast(
translation.format(
"import_failed_toast",
"message" to (it.localizedMessage ?: it.message ?: "")
)
)
} }
}, },
dismissButton = { onDismiss = { showImportDialog = false },
TextButton(onClick = { showImportDialog = false }) { showCloseButton = false
Text(translation["button.cancel"])
}
}
) )
} }
} }
@@ -949,8 +947,8 @@ class HomeSettings : Routes.Route() {
key = "test_mode", key = "test_mode",
text = translation["test_mode_label"], text = translation["test_mode_label"],
defaultValue = true, defaultValue = true,
confirmDisableTitle = "Are you sure?", confirmDisableTitle = translation["purr_aura_disable_title"],
confirmDisableText = "Doing this will put your account at risk and cause bans!" confirmDisableText = translation["purr_aura_disable_text"]
) )
PreferenceToggle(context.sharedPreferences, key = "disable_feature_loading", text = translation["disable_feature_loading_label"]) PreferenceToggle(context.sharedPreferences, key = "disable_feature_loading", text = translation["disable_feature_loading_label"])
PreferenceToggle(context.sharedPreferences, key = "disable_mapper", text = translation["disable_auto_mapper_label"]) PreferenceToggle(context.sharedPreferences, key = "disable_mapper", text = translation["disable_auto_mapper_label"])

View File

@@ -58,6 +58,8 @@ import kotlin.math.roundToInt
import kotlin.random.Random import kotlin.random.Random
class RetroGameScreen : Routes.Route() { class RetroGameScreen : Routes.Route() {
override val translation by lazy { context.translation.getCategory("manager.sections.retro_flight") }
override val content: @Composable (NavBackStackEntry) -> Unit = { override val content: @Composable (NavBackStackEntry) -> Unit = {
val gridWidth = 120 val gridWidth = 120
val gridHeight = 160 val gridHeight = 160
@@ -206,7 +208,7 @@ class RetroGameScreen : Routes.Route() {
verticalArrangement = Arrangement.spacedBy(12.dp) verticalArrangement = Arrangement.spacedBy(12.dp)
) { ) {
FloatingTopBar( FloatingTopBar(
title = "Retro Flight", title = translation["title"],
onBack = { routes.navController.popBackStack() } onBack = { routes.navController.popBackStack() }
) )
Spacer(modifier = Modifier.height(6.dp)) Spacer(modifier = Modifier.height(6.dp))
@@ -243,7 +245,7 @@ class RetroGameScreen : Routes.Route() {
modifier = Modifier.align(Alignment.Center) modifier = Modifier.align(Alignment.Center)
) { ) {
Text( Text(
text = "GAME OVER", text = translation["game_over_label"],
color = Color.White, color = Color.White,
fontSize = 14.sp, fontSize = 14.sp,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
@@ -258,7 +260,7 @@ class RetroGameScreen : Routes.Route() {
), ),
shape = RoundedCornerShape(6.dp) shape = RoundedCornerShape(6.dp)
) { ) {
Text("RESTART", fontFamily = pixelFont, fontSize = 12.sp) Text(translation["restart_button"], fontFamily = pixelFont, fontSize = 12.sp)
} }
} }
} }
@@ -293,7 +295,7 @@ class RetroGameScreen : Routes.Route() {
) { ) {
Box(contentAlignment = Alignment.Center) { Box(contentAlignment = Alignment.Center) {
Text( Text(
text = "LEFT", text = translation["left_button"],
color = Color.White, color = Color.White,
fontSize = 14.sp, fontSize = 14.sp,
fontFamily = pixelFont, fontFamily = pixelFont,
@@ -324,7 +326,7 @@ class RetroGameScreen : Routes.Route() {
) { ) {
Box(contentAlignment = Alignment.Center) { Box(contentAlignment = Alignment.Center) {
Text( Text(
text = "RIGHT", text = translation["right_button"],
color = Color.White, color = Color.White,
fontSize = 14.sp, fontSize = 14.sp,
fontFamily = pixelFont, fontFamily = pixelFont,

View File

@@ -226,7 +226,20 @@
"quick_actions_empty_subtitle": "Design your dream grid with the actions you use the most.", "quick_actions_empty_subtitle": "Design your dream grid with the actions you use the most.",
"quick_actions_add_tile_button": "Add tile", "quick_actions_add_tile_button": "Add tile",
"quick_actions_manage_button": "Manage", "quick_actions_manage_button": "Manage",
"quick_actions_count_label": "{count} curated shortcuts" "quick_actions_count_label": "{count} curated shortcuts",
"enabled": "Enabled",
"disabled": "Disabled",
"changelog_dialog_title": "Changelog",
"changelog_dialog_update_button": "Update",
"changelog_dialog_cancel_button": "Cancel",
"changelog_dialog_loading": "Loading changelog...",
"changelog_dialog_error": "Failed to load changelog",
"changelog_dialog_empty": "Changelog not available",
"announcements_dialog_title": "Announcements",
"announcements_dialog_close_button": "Close",
"announcements_dialog_loading": "Loading announcements...",
"announcements_dialog_error": "Failed to load announcements",
"announcements_dialog_empty": "Announcements not available"
}, },
"home_about": { "home_about": {
"about_title": "PurrfectSnap", "about_title": "PurrfectSnap",
@@ -255,8 +268,11 @@
"success_toast": "Done!", "success_toast": "Done!",
"message_logger_summary": "{messageCount} messages\n{storyCount} stories", "message_logger_summary": "{messageCount} messages\n{storyCount} stories",
"export_button": "Export", "export_button": "Export",
"import_button": "Import",
"clear_button": "Clear", "clear_button": "Clear",
"view_logger_history_button": "View Logger History", "view_logger_history_button": "View Logger History",
"message_logger_import_title": "Import message logger",
"message_logger_import_text": "Importing will override your current message logger database. Continue?",
"ui_settings_title": "UI Settings", "ui_settings_title": "UI Settings",
"haptic_feedback_label": "Haptic Feedback", "haptic_feedback_label": "Haptic Feedback",
"use_system_toasts_label": "Use System Toasts", "use_system_toasts_label": "Use System Toasts",
@@ -287,16 +303,29 @@
"customize_bottom_bar_title": "Customize Bottom Bar", "customize_bottom_bar_title": "Customize Bottom Bar",
"customize_bottom_bar_subtitle": "Pick which tabs show on your home screen", "customize_bottom_bar_subtitle": "Pick which tabs show on your home screen",
"available_tabs_title": "Available Tabs", "available_tabs_title": "Available Tabs",
"reset_setup_title": "Reset PurrfectSnap",
"reset_setup_action": "Reset and restart setup",
"reset_setup_dialog_title": "Are you sure?",
"reset_setup_dialog_text": "This will reset PurrfectSnap and restart setup.",
"reset_button": "Reset", "reset_button": "Reset",
"done_button": "Done", "done_button": "Done",
"clear_friend_feed": "Clear Friend Feed", "clear_friend_feed": "Clear Friend Feed",
"test_mode_label": "Enable PurrAura", "test_mode_label": "Enable PurrAura",
"purr_aura_disable_title": "Are you sure?",
"purr_aura_disable_text": "Doing this will put your account at risk and cause bans!",
"disable_feature_loading_label": "Disable Feature Loading", "disable_feature_loading_label": "Disable Feature Loading",
"disable_auto_mapper_label": "Disable Auto Mapper", "disable_auto_mapper_label": "Disable Auto Mapper",
"disable_bypass_indicator_label": "Disable Bypass Indicator", "disable_bypass_indicator_label": "Disable Bypass Indicator",
"open_file_failed_toast": "Failed to open file! {message}", "open_file_failed_toast": "Failed to open file! {message}",
"import_failed_toast": "Import failed: {message}" "import_failed_toast": "Import failed: {message}"
}, },
"retro_flight": {
"title": "Retro Flight",
"game_over_label": "GAME OVER",
"restart_button": "RESTART",
"left_button": "LEFT",
"right_button": "RIGHT"
},
"tasks": { "tasks": {
"no_tasks": "No tasks", "no_tasks": "No tasks",
"merge_button": "Merge", "merge_button": "Merge",
@@ -2920,6 +2949,7 @@
"save": "Save", "save": "Save",
"open": "Open", "open": "Open",
"download": "Download", "download": "Download",
"import": "Import",
"send": "Send", "send": "Send",
"restore_original": "Restore Original", "restore_original": "Restore Original",
"convert_external_media": "Convert External Media" "convert_external_media": "Convert External Media"
@@ -3586,4 +3616,4 @@
"openai": "OpenAI", "openai": "OpenAI",
"openrouter": "OpenRouter" "openrouter": "OpenRouter"
} }
} }