Skip to content

A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.

feat(i18n): add Chinese and English language support

guoai3f72fd9f355c
diff --git a/app/src/main/java/com/excp/podroid/MainActivity.kt b/app/src/main/java/com/excp/podroid/MainActivity.kt
index 123c16f..cab5c08 100644
--- a/app/src/main/java/com/excp/podroid/MainActivity.kt
+++ b/app/src/main/java/com/excp/podroid/MainActivity.kt
@@ -1,5 +1,6 @@
package com.excp.podroid
+import android.content.Context
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
@@ -13,6 +14,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.excp.podroid.data.repository.LanguageManager
import com.excp.podroid.ui.navigation.NavGraphViewModel
import com.excp.podroid.ui.navigation.PodroidNavGraph
import com.excp.podroid.ui.theme.PodroidTheme
@@ -21,6 +23,12 @@ import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
+ override fun attachBaseContext(newBase: Context?) {
+ val base = newBase ?: return super.attachBaseContext(null)
+ val savedLang = LanguageManager.getSavedLanguage(base)
+ super.attachBaseContext(LanguageManager.wrapContextForLocale(base, savedLang))
+ }
+
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
diff --git a/app/src/main/java/com/excp/podroid/data/repository/LanguageManager.kt b/app/src/main/java/com/excp/podroid/data/repository/LanguageManager.kt
new file mode 100644
index 0000000..2912d32
--- /dev/null
+++ b/app/src/main/java/com/excp/podroid/data/repository/LanguageManager.kt
@@ -0,0 +1,116 @@
+/*
+ * Podroid - Rootless Podman for Android
+ * Copyright (C) 2024-2026 Podroid contributors
+ */
+package com.excp.podroid.data.repository
+
+import android.content.Context
+import android.content.res.Configuration
+import android.os.Build
+import dagger.hilt.android.qualifiers.ApplicationContext
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.map
+import java.io.File
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class LanguageManager @Inject constructor(
+ @ApplicationContext private val context: Context,
+ private val settingsRepository: SettingsRepository,
+) {
+ companion object {
+ const val LANGUAGE_AUTO = "auto"
+ const val LANGUAGE_ZH = "zh"
+ const val LANGUAGE_EN = "en"
+
+ private const val LANG_CACHE_FILE = "podroid_lang_cache"
+
+ /**
+ * Synchronously reads the saved language preference from the cache file.
+ * Called from [MainActivity.attachBaseContext] before Hilt injection is available.
+ */
+ fun getSavedLanguage(ctx: Context): String {
+ return try {
+ val file = File(ctx.filesDir, LANG_CACHE_FILE)
+ if (file.exists()) file.readText().trim() else LANGUAGE_AUTO
+ } catch (_: Exception) {
+ LANGUAGE_AUTO
+ }
+ }
+
+ /**
+ * Persists the language preference to the cache file so it's available
+ * synchronously on the next process start.
+ */
+ fun persistLanguage(ctx: Context, language: String) {
+ try {
+ File(ctx.filesDir, LANG_CACHE_FILE).writeText(language)
+ } catch (_: Exception) {}
+ }
+
+ /**
+ * Wraps [base] in a [Context] whose resources are configured for [language].
+ * Returns [base] unchanged when [language] is [LANGUAGE_AUTO].
+ */
+ fun wrapContextForLocale(base: Context, language: String): Context {
+ if (language == LANGUAGE_AUTO) return base
+
+ val locale = when (language) {
+ LANGUAGE_ZH -> java.util.Locale("zh", "CN")
+ else -> java.util.Locale.ENGLISH
+ }
+
+ val config = Configuration(base.resources.configuration)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ config.setLocale(locale)
+ config.setLocales(android.os.LocaleList(locale))
+ } else {
+ @Suppress("DEPRECATION")
+ config.locale = locale
+ }
+
+ return base.createConfigurationContext(config)
+ }
+ }
+
+ private fun getSystemLanguage(): String {
+ val locale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ context.resources.configuration.locales.get(0)
+ } else {
+ @Suppress("DEPRECATION")
+ context.resources.configuration.locale
+ }
+ return when {
+ locale?.language == "zh" -> LANGUAGE_ZH
+ else -> LANGUAGE_EN
+ }
+ }
+
+ val language: Flow<String> = settingsRepository.language.map { prefLanguage ->
+ when (prefLanguage) {
+ LANGUAGE_AUTO -> getSystemLanguage()
+ LANGUAGE_ZH, LANGUAGE_EN -> prefLanguage
+ else -> getSystemLanguage()
+ }
+ }
+
+ /**
+ * Persists the selected language to both DataStore and the synchronous
+ * cache file. The caller is responsible for triggering Activity recreation
+ * so [attachBaseContext] picks up the new locale.
+ */
+ suspend fun setLanguage(language: String) {
+ settingsRepository.setLanguage(language)
+ persistLanguage(context, language)
+ }
+
+ suspend fun getCurrentLanguage(): String {
+ val prefLanguage = settingsRepository.getLanguageSnapshot()
+ return when (prefLanguage) {
+ LANGUAGE_AUTO -> getSystemLanguage()
+ LANGUAGE_ZH, LANGUAGE_EN -> prefLanguage
+ else -> getSystemLanguage()
+ }
+ }
+}
diff --git a/app/src/main/java/com/excp/podroid/data/repository/SettingsRepository.kt b/app/src/main/java/com/excp/podroid/data/repository/SettingsRepository.kt
index 907eabd..66263d8 100644
--- a/app/src/main/java/com/excp/podroid/data/repository/SettingsRepository.kt
+++ b/app/src/main/java/com/excp/podroid/data/repository/SettingsRepository.kt
@@ -65,6 +65,7 @@ class SettingsRepository @Inject constructor(
val KEY_X11_ROTATION = stringPreferencesKey("x11_rotation_lock")
val KEY_X11_SHOW_EXTRA_KEYS = booleanPreferencesKey("x11_show_extra_keys")
val KEY_X11_DPI = intPreferencesKey("x11_dpi")
+ val KEY_LANGUAGE = stringPreferencesKey("language")
/**
* Default tunable QEMU args — CPU model, accel tuning, RNG source, overcommit.
@@ -124,6 +125,9 @@ class SettingsRepository @Inject constructor(
val hapticsEnabled = pref(KEY_HAPTICS_ENABLED, true)
val dynamicColorEnabled = pref(KEY_DYNAMIC_COLOR_ENABLED, false)
val lastBootDurationMs = pref(KEY_LAST_BOOT_DURATION_MS, 0L)
+ val language: Flow<String> = context.dataStore.data.map { prefs ->
+ prefs[KEY_LANGUAGE] ?: "auto"
+ }
val avfHintDismissed = pref(KEY_AVF_HINT_DISMISSED, false)
val usbPassthroughEnabled = pref(KEY_USB_PASSTHROUGH_ENABLED, false)
val avfVerboseLogging: Flow<Boolean> = context.dataStore.data
@@ -152,6 +156,7 @@ class SettingsRepository @Inject constructor(
suspend fun setHapticsEnabled(value: Boolean) = set(KEY_HAPTICS_ENABLED, value)
suspend fun setDynamicColorEnabled(value: Boolean) = set(KEY_DYNAMIC_COLOR_ENABLED, value)
suspend fun setLastBootDurationMs(value: Long) = set(KEY_LAST_BOOT_DURATION_MS, value)
+ suspend fun setLanguage(value: String) = set(KEY_LANGUAGE, value)
suspend fun setEngineSelection(value: EngineSelection) = set(KEY_ENGINE_SELECTION, value.name)
suspend fun setAvfHintDismissed(value: Boolean) = set(KEY_AVF_HINT_DISMISSED, value)
suspend fun setAvfVerboseLogging(value: Boolean) = set(KEY_AVF_VERBOSE_LOGGING, value)
@@ -188,6 +193,7 @@ class SettingsRepository @Inject constructor(
suspend fun setX11ShowExtraKeys(v: Boolean) = set(KEY_X11_SHOW_EXTRA_KEYS, v)
suspend fun setX11Dpi(v: Int) = set(KEY_X11_DPI, v)
suspend fun getX11DpiSnapshot() = (x11Settings.first()).dpi
+ suspend fun getLanguageSnapshot() = language.first()
// Snapshots used by non-Compose call sites (PodroidService, exporters).
suspend fun getSshEnabledSnapshot() = sshEnabled.first()
diff --git a/app/src/main/java/com/excp/podroid/ui/navigation/NavGraph.kt b/app/src/main/java/com/excp/podroid/ui/navigation/NavGraph.kt
index 968358c..374a32c 100644
--- a/app/src/main/java/com/excp/podroid/ui/navigation/NavGraph.kt
+++ b/app/src/main/java/com/excp/podroid/ui/navigation/NavGraph.kt
@@ -2,7 +2,9 @@ package com.excp.podroid.ui.navigation
import androidx.compose.material3.windowsizeclass.WindowSizeClass
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.remember
import androidx.compose.runtime.getValue
+import androidx.activity.compose.LocalActivity
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
@@ -107,6 +109,10 @@ fun PodroidNavGraph(
}
composable(Routes.SETTINGS) {
+ val activity = LocalActivity.current
+ val onLanguageChanged = remember(activity) {
+ { activity?.recreate() ?: Unit }
+ }
SettingsScreen(
windowSizeClass = windowSizeClass,
onNavigateBack = {
@@ -118,6 +124,7 @@ fun PodroidNavGraph(
}
}
},
+ onLanguageChanged = onLanguageChanged,
)
}
}
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/home/HomeScreen.kt b/app/src/main/java/com/excp/podroid/ui/screens/home/HomeScreen.kt
index fe6bbbb..80f3b67 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/home/HomeScreen.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/home/HomeScreen.kt
@@ -33,11 +33,13 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.excp.podroid.BuildConfig
+import com.excp.podroid.R
import com.excp.podroid.engine.VmState
import com.excp.podroid.ui.components.AdaptiveContainer
import com.excp.podroid.ui.components.PodroidDestructiveButton
@@ -77,8 +79,8 @@ fun HomeScreen(
AlertDialog(
onDismissRequest = { viewModel.dismissUpdate() },
icon = { Icon(Icons.Default.SystemUpdate, contentDescription = null) },
- title = { Text("Update available") },
- text = { Text("Version ${info.latestVersion} is available. You have ${BuildConfig.VERSION_NAME}.") },
+ title = { Text(stringResource(R.string.update_available)) },
+ text = { Text(stringResource(R.string.version_available, info.latestVersion, BuildConfig.VERSION_NAME)) },
confirmButton = {
TextButton(onClick = {
// Guard against ActivityNotFoundException (no browser) or a
@@ -87,10 +89,10 @@ fun HomeScreen(
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(info.releaseUrl)))
}
viewModel.dismissUpdate()
- }) { Text("Download") }
+ }) { Text(stringResource(R.string.download)) }
},
dismissButton = {
- TextButton(onClick = { viewModel.dismissUpdate() }) { Text("Later") }
+ TextButton(onClick = { viewModel.dismissUpdate() }) { Text(stringResource(R.string.later)) }
},
)
}
@@ -98,10 +100,10 @@ fun HomeScreen(
Scaffold(
topBar = {
PodroidTopBar(
- title = "Podroid",
+ title = stringResource(R.string.app_name),
actions = {
IconButton(onClick = onNavigateToSettings) {
- Icon(Icons.Default.Settings, contentDescription = "Settings")
+ Icon(Icons.Default.Settings, contentDescription = stringResource(R.string.settings))
}
},
)
@@ -199,19 +201,16 @@ private fun AvfHintBanner(onDismiss: () -> Unit) {
verticalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM),
) {
Text(
- "AVF (KVM) available on this device",
+ stringResource(R.string.avf_available),
style = MaterialTheme.typography.titleSmall,
)
Text(
- "Needs a PC with adb, or the Shizuku app for on-device grant. Run once:",
+ stringResource(R.string.avf_hint_needs_pc),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
- text = "adb shell pm grant com.excp.podroid \\\n" +
- " android.permission.MANAGE_VIRTUAL_MACHINE\n" +
- "adb shell pm grant com.excp.podroid \\\n" +
- " android.permission.USE_CUSTOM_VIRTUAL_MACHINE",
+ text = stringResource(R.string.avf_grant_commands),
fontFamily = FontFamily.Monospace,
style = MaterialTheme.typography.bodySmall,
)
@@ -220,7 +219,7 @@ private fun AvfHintBanner(onDismiss: () -> Unit) {
modifier = Modifier.fillMaxWidth(),
) {
TextButton(onClick = onDismiss) {
- Text("Dismiss")
+ Text(stringResource(R.string.dismiss))
}
}
}
@@ -236,12 +235,12 @@ private fun HomeStatusBlock(
meta: HomeMeta,
uptimeLabel: String?,
) {
- PodroidSectionLabel("VM Status")
+ PodroidSectionLabel(stringResource(R.string.vm_status))
Text(
text = when {
- isStarting -> "Starting"
- isRunning -> "Running"
- else -> "Stopped"
+ isStarting -> stringResource(R.string.status_starting)
+ isRunning -> stringResource(R.string.status_running)
+ else -> stringResource(R.string.status_stopped)
},
style = MaterialTheme.typography.displayLarge,
color = when {
@@ -257,9 +256,9 @@ private fun HomeStatusBlock(
verticalAlignment = Alignment.CenterVertically,
) {
val (dot, label) = when {
- isRunning -> PodroidStatusColors.Running to (uptimeLabel ?: "Up")
- isStarting -> PodroidStatusColors.Starting to bootStage.ifEmpty { "Starting" }
- else -> PodroidStatusColors.Stopped to "Idle"
+ isRunning -> PodroidStatusColors.Running to (uptimeLabel ?: stringResource(R.string.up))
+ isStarting -> PodroidStatusColors.Starting to bootStage.ifEmpty { stringResource(R.string.status_starting) }
+ else -> PodroidStatusColors.Stopped to stringResource(R.string.status_idle)
}
PodroidStatus(label = label, dotColor = dot)
Text(
@@ -270,7 +269,7 @@ private fun HomeStatusBlock(
}
if (vmState is VmState.Error) {
Spacer(Modifier.height(PodroidTokens.Spacing.MD))
- PodroidSectionLabel("Error")
+ PodroidSectionLabel(stringResource(R.string.error_title))
Text(
text = vmState.message,
style = MaterialTheme.typography.bodyMedium,
@@ -293,27 +292,28 @@ private fun HomeDataSection(
if (showStarting || showError) return
Spacer(Modifier.height(PodroidTokens.Spacing.MD))
if (isRunning) {
- PodroidSectionLabel("Network")
- PodroidListRow(label = "Phone IP", value = phoneIp, mono = true)
+ PodroidSectionLabel(stringResource(R.string.network))
+ PodroidListRow(label = stringResource(R.string.phone_ip), value = phoneIp, mono = true)
PodroidListRow(
- label = "SSH",
- value = if (meta.sshEnabled) ":9922 · podroid" else "Off",
+ label = stringResource(R.string.ssh),
+ value = if (meta.sshEnabled) ":9922 · podroid" else stringResource(R.string.off),
mono = meta.sshEnabled,
)
PodroidListRow(
- label = "Port forwards",
- value = if (meta.portForwardCount == 0) "None" else "${meta.portForwardCount} active",
+ label = stringResource(R.string.port_forwards),
+ value = if (meta.portForwardCount == 0) stringResource(R.string.none)
+ else "${meta.portForwardCount} ${stringResource(R.string.active)}",
)
} else {
- PodroidSectionLabel("Last session")
+ PodroidSectionLabel(stringResource(R.string.last_session))
if (meta.lastBootDurationMs > 0L) {
PodroidListRow(
- label = "Booted in",
+ label = stringResource(R.string.booted_in),
value = formatBootDuration(meta.lastBootDurationMs),
)
}
PodroidListRow(
- label = "Build",
+ label = stringResource(R.string.build),
value = "v${BuildConfig.VERSION_NAME} · QEMU ${BuildConfig.QEMU_VERSION}",
mono = true,
)
@@ -343,17 +343,17 @@ private fun HomeActionButtons(
onOpenTerminal: () -> Unit,
) {
if (isRunning) {
- PodroidPrimaryButton(text = "Open Terminal", onClick = onOpenTerminal)
+ PodroidPrimaryButton(text = stringResource(R.string.open_terminal), onClick = onOpenTerminal)
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
Row(horizontalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM)) {
- PodroidGhostButton(text = "Restart", onClick = onRestart, modifier = Modifier.weight(1f))
- PodroidDestructiveButton(text = "Stop", onClick = onStop, modifier = Modifier.weight(1f))
+ PodroidGhostButton(text = stringResource(R.string.restart), onClick = onRestart, modifier = Modifier.weight(1f))
+ PodroidDestructiveButton(text = stringResource(R.string.stop), onClick = onStop, modifier = Modifier.weight(1f))
}
} else if (isStarting) {
- PodroidDestructiveButton(text = "Stop", onClick = onStop)
+ PodroidDestructiveButton(text = stringResource(R.string.stop), onClick = onStop)
} else if (vmState is VmState.Error) {
- PodroidPrimaryButton(text = "Try again", onClick = onStart)
+ PodroidPrimaryButton(text = stringResource(R.string.try_again), onClick = onStart)
} else {
- PodroidPrimaryButton(text = "Start VM", onClick = onStart)
+ PodroidPrimaryButton(text = stringResource(R.string.start_vm), onClick = onStart)
}
}
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/settings/SettingsScreen.kt b/app/src/main/java/com/excp/podroid/ui/screens/settings/SettingsScreen.kt
index da40eb2..44fcee0 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/settings/SettingsScreen.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/settings/SettingsScreen.kt
@@ -51,6 +51,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
@@ -62,6 +63,7 @@ import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.excp.podroid.BuildConfig
+import com.excp.podroid.R
import com.excp.podroid.data.repository.PortForwardRule
import com.excp.podroid.engine.EngineSelection
import com.excp.podroid.engine.VmState
@@ -80,6 +82,17 @@ import com.excp.podroid.ui.components.PodroidSectionLabel
import com.excp.podroid.ui.components.PodroidSwitch
import com.excp.podroid.ui.components.PodroidTopBar
import com.excp.podroid.ui.theme.PodroidTokens
+import com.excp.podroid.data.repository.LanguageManager
+
+@Composable
+private fun languageDisplayName(language: String, systemDefaultLanguage: String): String {
+ val effectiveLang = if (language == "auto") systemDefaultLanguage else language
+ return when (effectiveLang) {
+ LanguageManager.LANGUAGE_ZH -> stringResource(R.string.language_zh)
+ LanguageManager.LANGUAGE_EN -> stringResource(R.string.language_en)
+ else -> stringResource(R.string.system_default)
+ }
+}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@@ -87,6 +100,7 @@ fun SettingsScreen(
windowSizeClass: WindowSizeClass,
onNavigateBack: () -> Unit,
onThemeOrFontChanged: () -> Unit = {},
+ onLanguageChanged: () -> Unit = {},
viewModel: SettingsViewModel = hiltViewModel(),
) {
val ui by viewModel.uiState.collectAsStateWithLifecycle()
@@ -98,6 +112,7 @@ fun SettingsScreen(
var advancedExpanded by remember { mutableStateOf(false) }
var showAddDialog by remember { mutableStateOf(false) }
var showResetDialog by remember { mutableStateOf(false) }
+ var showLanguageDialog by remember { mutableStateOf(false) }
var avfReportText by remember { mutableStateOf<String?>(null) }
var avfRunning by remember { mutableStateOf(false) }
val avfScope = rememberCoroutineScope()
@@ -137,10 +152,10 @@ fun SettingsScreen(
Scaffold(
topBar = {
PodroidTopBar(
- title = "Settings",
+ title = stringResource(R.string.settings),
navigationIcon = {
IconButton(onClick = onNavigateBack) {
- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
}
},
)
@@ -163,9 +178,9 @@ fun SettingsScreen(
.padding(horizontal = PodroidTokens.Spacing.XL),
) {
// ── APPEARANCE ────────────────────────────────────────
- PodroidSectionLabel("Appearance")
+ PodroidSectionLabel(stringResource(R.string.appearance))
PodroidListRow(
- label = "Dark theme",
+ label = stringResource(R.string.dark_theme),
rightSlot = {
PodroidSwitch(
checked = ui.darkTheme,
@@ -177,7 +192,7 @@ fun SettingsScreen(
},
)
PodroidListRow(
- label = "Dynamic color (Material You)",
+ label = stringResource(R.string.dynamic_color),
rightSlot = {
PodroidSwitch(
checked = ui.dynamicColorEnabled,
@@ -189,11 +204,19 @@ fun SettingsScreen(
},
)
+ // ── LANGUAGE ───────────────────────────────────────────
+ PodroidSectionLabel(stringResource(R.string.language_label))
+ PodroidListRow(
+ label = stringResource(R.string.language_label),
+ value = languageDisplayName(ui.language, ui.systemDefaultLanguage),
+ onClick = { showLanguageDialog = true },
+ )
+
// ── VM RESOURCES ──────────────────────────────────────
- PodroidSectionLabel("VM Resources")
+ PodroidSectionLabel(stringResource(R.string.vm_resources))
if (!vmNotRunning) {
Text(
- text = "Stop the VM to change these settings.",
+ text = stringResource(R.string.stop_vm_to_change),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.error,
modifier = Modifier.padding(top = PodroidTokens.Spacing.SM),
@@ -210,19 +233,19 @@ fun SettingsScreen(
enabled = vmNotRunning,
)
PodroidListRow(
- label = "Storage",
+ label = stringResource(R.string.storage),
value = "${ui.storageSizeGb} GB",
)
// ── NETWORK ───────────────────────────────────────────
- PodroidSectionLabel("Network")
+ PodroidSectionLabel(stringResource(R.string.network))
PodroidListRow(
- label = "Phone IP",
+ label = stringResource(R.string.phone_ip),
value = viewModel.phoneIp,
mono = true,
)
PodroidListRow(
- label = "SSH (port 9922, password \"podroid\")",
+ label = stringResource(R.string.ssh),
rightSlot = {
PodroidSwitch(
checked = ui.sshEnabled,
@@ -238,7 +261,7 @@ fun SettingsScreen(
)
// ── STORAGE / SHARING ─────────────────────────────────
- PodroidSectionLabel("Storage")
+ PodroidSectionLabel(stringResource(R.string.storage))
DownloadsSharingRow(
enabled = ui.storageAccessEnabled,
vmNotRunning = vmNotRunning,
@@ -255,19 +278,19 @@ fun SettingsScreen(
)
Spacer(Modifier.height(PodroidTokens.Spacing.MD))
PodroidDestructiveButton(
- text = "Reset VM (deletes all data)",
+ text = stringResource(R.string.reset_vm),
onClick = { showResetDialog = true },
)
// ── ADVANCED ──────────────────────────────────────────
- PodroidSectionLabel("Advanced")
+ PodroidSectionLabel(stringResource(R.string.advanced))
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
PodroidGhostButton(
- text = if (advancedExpanded) "Hide advanced" else "Show advanced",
+ text = if (advancedExpanded) stringResource(R.string.hide_advanced) else stringResource(R.string.show_advanced),
onClick = { advancedExpanded = !advancedExpanded },
)
if (advancedExpanded) {
- PodroidSectionLabel("Backend")
+ PodroidSectionLabel(stringResource(R.string.backend))
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
@@ -281,9 +304,9 @@ fun SettingsScreen(
label = {
Text(
when (sel) {
- EngineSelection.AUTO -> "Auto"
- EngineSelection.AVF -> "AVF (KVM)"
- EngineSelection.QEMU -> "QEMU (TCG)"
+ EngineSelection.AUTO -> stringResource(R.string.auto)
+ EngineSelection.AVF -> stringResource(R.string.avf_kvm)
+ EngineSelection.QEMU -> stringResource(R.string.qemu_tcg)
},
fontFamily = FontFamily.Monospace,
)
@@ -306,21 +329,21 @@ fun SettingsScreen(
}
// ── ABOUT ─────────────────────────────────────────────
- PodroidSectionLabel("About")
- PodroidListRow(label = "Version", value = "v${BuildConfig.VERSION_NAME}", mono = true)
- PodroidListRow(label = "QEMU", value = "v${BuildConfig.QEMU_VERSION}", mono = true)
- PodroidListRow(label = "Architecture", value = "AArch64", mono = true)
- PodroidListRow(label = "Linux distro", value = "Alpine 3.23", mono = true)
+ PodroidSectionLabel(stringResource(R.string.about))
+ PodroidListRow(label = stringResource(R.string.version_label), value = "v${BuildConfig.VERSION_NAME}", mono = true)
+ PodroidListRow(label = stringResource(R.string.qemu_label), value = "v${BuildConfig.QEMU_VERSION}", mono = true)
+ PodroidListRow(label = stringResource(R.string.architecture), value = "AArch64", mono = true)
+ PodroidListRow(label = stringResource(R.string.linux_distro), value = "Alpine 3.23", mono = true)
Spacer(Modifier.height(PodroidTokens.Spacing.MD))
PodroidGhostButton(
- text = "Export diagnostic log",
+ text = stringResource(R.string.export_diagnostic_log),
onClick = { viewModel.exportConsoleLogs() },
)
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
// Use lifecycle-aware collection to match the rest of the screen.
val avfVerbose by viewModel.avfVerboseLogging.collectAsStateWithLifecycle()
PodroidListRow(
- label = "Verbose AVF logging",
+ label = stringResource(R.string.verbose_avf_logging),
rightSlot = {
PodroidSwitch(
checked = avfVerbose,
@@ -329,7 +352,7 @@ fun SettingsScreen(
},
)
PodroidGhostButton(
- text = if (avfRunning) "Running AVF diagnostic…" else "AVF (pKVM) diagnostic",
+ text = if (avfRunning) stringResource(R.string.running_avf_diagnostic) else stringResource(R.string.avf_diagnostic),
onClick = {
if (avfRunning) return@PodroidGhostButton
avfRunning = true
@@ -370,7 +393,7 @@ fun SettingsScreen(
avfReportText?.let { report ->
AlertDialog(
onDismissRequest = { avfReportText = null },
- title = { Text("AVF (pKVM) diagnostic") },
+ title = { Text(stringResource(R.string.avf_diagnostic)) },
text = {
androidx.compose.material3.Card(
colors = androidx.compose.material3.CardDefaults.cardColors(
@@ -396,7 +419,7 @@ fun SettingsScreen(
}
},
confirmButton = {
- TextButton(onClick = { avfReportText = null }) { Text("Close") }
+ TextButton(onClick = { avfReportText = null }) { Text(stringResource(R.string.close)) }
},
)
}
@@ -404,25 +427,56 @@ fun SettingsScreen(
if (showResetDialog) {
AlertDialog(
onDismissRequest = { showResetDialog = false },
- title = { Text("Full App Reset?") },
+ title = { Text(stringResource(R.string.reset_vm_description)) },
text = {
- Text(
- "This will clear ALL application data, including your VM storage, " +
- "settings, and port rules. The app will close and return to a " +
- "freshly-installed state."
- )
+ Text(stringResource(R.string.reset_vm_text))
},
confirmButton = {
TextButton(onClick = {
viewModel.resetVm()
showResetDialog = false
}) {
- Text("Reset Everything", color = MaterialTheme.colorScheme.error)
+ Text(stringResource(R.string.reset_everything), color = MaterialTheme.colorScheme.error)
}
},
dismissButton = {
TextButton(onClick = { showResetDialog = false }) {
- Text("Cancel")
+ Text(stringResource(R.string.cancel))
+ }
+ },
+ )
+ }
+
+ if (showLanguageDialog) {
+ AlertDialog(
+ onDismissRequest = { showLanguageDialog = false },
+ title = { Text(stringResource(R.string.language_label)) },
+ text = {
+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ listOf(
+ "auto" to stringResource(R.string.system_default),
+ "zh" to stringResource(R.string.language_zh),
+ "en" to stringResource(R.string.language_en),
+ ).forEach { (code, label) ->
+ FilterChip(
+ selected = ui.language == code,
+ onClick = {
+ avfScope.launch {
+ viewModel.setLanguage(code)
+ showLanguageDialog = false
+ onLanguageChanged()
+ }
+ },
+ label = { Text(label) },
+ shape = RoundedCornerShape(PodroidTokens.Radius.Chip),
+ colors = PodroidChipColors(),
+ )
+ }
+ }
+ },
+ confirmButton = {
+ TextButton(onClick = { showLanguageDialog = false }) {
+ Text(stringResource(R.string.cancel))
}
},
)
@@ -434,7 +488,7 @@ fun SettingsScreen(
private fun RamSection(currentMb: Int, onChange: (Int) -> Unit, enabled: Boolean) {
Column(modifier = Modifier.padding(bottom = PodroidTokens.Spacing.SM)) {
Text(
- "RAM · ${if (currentMb >= 1024) "${currentMb / 1024} GB" else "$currentMb MB"}",
+ "${stringResource(R.string.ram_label)} · ${if (currentMb >= 1024) "${currentMb / 1024} GB" else "$currentMb MB"}",
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface,
modifier = Modifier.padding(
@@ -471,7 +525,7 @@ private fun RamSection(currentMb: Int, onChange: (Int) -> Unit, enabled: Boolean
private fun CpusSection(currentCpus: Int, onChange: (Int) -> Unit, enabled: Boolean) {
Column(modifier = Modifier.padding(bottom = PodroidTokens.Spacing.SM)) {
Text(
- "CPU cores · $currentCpus",
+ "${stringResource(R.string.cpu_cores)} · $currentCpus",
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface,
modifier = Modifier.padding(
@@ -510,8 +564,8 @@ private fun PortForwardSection(
onRemove: (PortForwardRule) -> Unit,
) {
PodroidListRow(
- label = "Port forwards (${rules.size})",
- rightSlot = { PodroidInlineAction(label = "+ Add", onClick = onAdd) },
+ label = stringResource(R.string.port_forwards_count).replace("{count}", rules.size.toString()),
+ rightSlot = { PodroidInlineAction(label = stringResource(R.string.add_btn), onClick = onAdd) },
)
rules.forEach { rule ->
key(rule.hostPort, rule.protocol) {
@@ -532,7 +586,7 @@ private fun PortForwardSection(
IconButton(onClick = { onRemove(rule) }) {
Icon(
Icons.Default.Delete,
- contentDescription = "Remove",
+ contentDescription = stringResource(R.string.remove),
tint = MaterialTheme.colorScheme.error,
)
}
@@ -578,7 +632,7 @@ private fun DownloadsSharingRow(
}
PodroidListRow(
- label = "Downloads sharing",
+ label = stringResource(R.string.downloads_sharing),
rightSlot = {
PodroidSwitch(
checked = enabled && available,
@@ -594,9 +648,7 @@ private fun DownloadsSharingRow(
)
if (!available) {
Text(
- text = "Not available on this $activeBackendId build — AVF requires a privileged " +
- "system-app install (Google's Terminal app cheats this way); third-party " +
- "APKs can't cross SELinux domains to read /storage/emulated/Download.",
+ text = stringResource(R.string.downloads_sharing_unavailable, activeBackendId),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(
@@ -624,7 +676,7 @@ private fun UsbPassthroughRow(
onToggle: (Boolean) -> Unit,
) {
PodroidListRow(
- label = "USB passthrough",
+ label = stringResource(R.string.usb_passthrough_settings_label),
rightSlot = {
PodroidSwitch(
checked = enabled && available,
@@ -635,12 +687,9 @@ private fun UsbPassthroughRow(
)
Text(
text = if (available) {
- "Hot-plugs external USB devices (Wi-Fi, storage, serial, etc.) into the " +
- "VM. Each device asks for permission when attached. Adds a USB " +
- "controller at boot, so restart the VM to apply."
+ stringResource(R.string.usb_passthrough_settings_description_available)
} else {
- "Not available on the $activeBackendId backend: USB passthrough rides " +
- "QEMU's QMP control socket, which the AVF backend doesn't provide."
+ stringResource(R.string.usb_passthrough_settings_description_unavailable, activeBackendId)
},
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
@@ -671,14 +720,14 @@ private fun AdvancedFieldsBlock(
) {
if (!enabled) {
Text(
- text = "Stop the VM before editing — changes apply on next boot.",
+ text = stringResource(R.string.stop_vm_before_edit),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.error,
)
}
AdvancedTextSetting(
- label = "Extra QEMU args",
- helper = "-cpu, -accel, -object, -device, -overcommit, etc. Whitespace-separated.",
+ label = stringResource(R.string.extra_qemu_args),
+ helper = stringResource(R.string.qemu_args_helper),
value = qemuExtraArgs,
enabled = enabled,
onValueChange = onQemuChange,
@@ -686,8 +735,8 @@ private fun AdvancedFieldsBlock(
minLines = 4,
)
AdvancedTextSetting(
- label = "Extra kernel cmdline",
- helper = "Appended after console=ttyAMA0 — controls scheduler, mitigations, log level, etc.",
+ label = stringResource(R.string.extra_kernel_cmdline),
+ helper = stringResource(R.string.kernel_cmdline_helper),
value = kernelExtraCmdline,
enabled = enabled,
onValueChange = onKernelChange,
@@ -708,17 +757,18 @@ private fun AddPortForwardDialog(
var guestPort by remember { mutableStateOf("") }
var protocol by remember { mutableStateOf("tcp") }
var error by remember { mutableStateOf<String?>(null) }
+ val invalidPortsMsg = stringResource(R.string.enter_valid_ports)
AlertDialog(
onDismissRequest = onDismiss,
- title = { Text("Add port forward") },
+ title = { Text(stringResource(R.string.add_port_forward)) },
text = {
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
OutlinedTextField(
value = hostPort,
onValueChange = { hostPort = it; error = null },
- label = { Text("Android port") },
- placeholder = { Text("e.g. 8080") },
+ label = { Text(stringResource(R.string.android_port)) },
+ placeholder = { Text(stringResource(R.string.e_g_8080)) },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
singleLine = true,
modifier = Modifier.fillMaxWidth(),
@@ -726,8 +776,8 @@ private fun AddPortForwardDialog(
OutlinedTextField(
value = guestPort,
onValueChange = { guestPort = it; error = null },
- label = { Text("VM port") },
- placeholder = { Text("e.g. 80") },
+ label = { Text(stringResource(R.string.vm_port)) },
+ placeholder = { Text(stringResource(R.string.e_g_80)) },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
singleLine = true,
modifier = Modifier.fillMaxWidth(),
@@ -762,17 +812,17 @@ private fun AddPortForwardDialog(
val hp = hostPort.toIntOrNull()
val gp = guestPort.toIntOrNull()
if (hp == null || gp == null || hp !in 1..65535 || gp !in 1..65535) {
- error = "Enter valid port numbers (1–65535)"
+ error = invalidPortsMsg
return@TextButton
}
val added = onAdd(hp, gp, protocol)
if (!added) error = "Port $hp (${protocol.uppercase()}) is already forwarded"
}) {
- Text("Add")
+ Text(stringResource(R.string.add))
}
},
dismissButton = {
- TextButton(onClick = onDismiss) { Text("Cancel") }
+ TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) }
},
)
}
@@ -830,7 +880,7 @@ private fun AdvancedTextSetting(
modifier = Modifier.weight(1f),
)
TextButton(onClick = onReset, enabled = enabled) {
- Text("Reset")
+ Text(stringResource(R.string.reset))
}
}
}
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/settings/SettingsViewModel.kt b/app/src/main/java/com/excp/podroid/ui/screens/settings/SettingsViewModel.kt
index 535b4d0..bf18bb3 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/settings/SettingsViewModel.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/settings/SettingsViewModel.kt
@@ -14,6 +14,7 @@ import androidx.core.content.FileProvider
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.excp.podroid.BuildConfig
+import com.excp.podroid.data.repository.LanguageManager
import com.excp.podroid.data.repository.PortForwardRepository
import com.excp.podroid.data.repository.PortForwardRule
import com.excp.podroid.data.repository.SettingsRepository
@@ -56,6 +57,8 @@ data class SettingsUiState(
val darkTheme: Boolean = false,
val dynamicColorEnabled: Boolean = false,
val engineSelection: EngineSelection = EngineSelection.AUTO,
+ val language: String = "auto",
+ val systemDefaultLanguage: String = "auto",
)
@HiltViewModel
@@ -64,6 +67,7 @@ class SettingsViewModel @Inject constructor(
private val settingsRepository: SettingsRepository,
private val portForwardRepository: PortForwardRepository,
private val engine: VmEngine,
+ private val languageManager: LanguageManager,
) : ViewModel() {
val vmRamMb: StateFlow<Int> = settingsRepository.vmRamMb
@@ -104,7 +108,9 @@ class SettingsViewModel @Inject constructor(
arrayOf(storageAccess, qemu, kernel, dark, dyn)
},
settingsRepository.engineSelection,
- ) { a, b, engineSel ->
+ settingsRepository.language,
+ languageManager.language,
+ ) { a, b, engineSel, lang, sysLang ->
SettingsUiState(
vmRamMb = a[0] as Int,
vmCpus = a[1] as Int,
@@ -116,6 +122,8 @@ class SettingsViewModel @Inject constructor(
darkTheme = b[3] as Boolean,
dynamicColorEnabled = b[4] as Boolean,
engineSelection = engineSel,
+ language = lang,
+ systemDefaultLanguage = sysLang,
)
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), SettingsUiState())
@@ -178,6 +186,12 @@ class SettingsViewModel @Inject constructor(
viewModelScope.launch { settingsRepository.setUsbPassthroughEnabled(value) }
}
+ suspend fun setLanguage(value: String) {
+ Log.d(TAG, "setLanguage: $value")
+ languageManager.setLanguage(value)
+ Log.d(TAG, "setLanguage done")
+ }
+
fun setVmRamMb(value: Int) {
viewModelScope.launch { settingsRepository.setVmRamMb(value) }
}
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/setup/SetupScreen.kt b/app/src/main/java/com/excp/podroid/ui/screens/setup/SetupScreen.kt
index f6ffb8f..944b11d 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/setup/SetupScreen.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/setup/SetupScreen.kt
@@ -53,10 +53,12 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.excp.podroid.R
import com.excp.podroid.ui.components.AdaptiveContainer
import com.excp.podroid.ui.components.PodroidGhostButton
import com.excp.podroid.ui.components.PodroidListRow
@@ -335,9 +337,9 @@ private fun StoragePage(
) {
SetupPageLayout(
windowSizeClass = windowSizeClass,
- stepLabel = "Step 1 of 3",
- title = "Persistent Storage",
- description = "Storage for installed packages, container images, and your files. Cannot be resized later without resetting the VM.",
+ stepLabel = stringResource(R.string.step_1_of_4),
+ title = stringResource(R.string.persistent_storage),
+ description = stringResource(R.string.storage_description),
bottomBar = { SetupNextBar(onNext = onNext) },
) {
Text(
@@ -362,25 +364,25 @@ private fun VmConfigPage(
) {
SetupPageLayout(
windowSizeClass = windowSizeClass,
- stepLabel = "Step 2 of 3",
- title = "Configure your VM",
- description = "Defaults tuned for performance and battery. Change anytime in Settings.",
- bottomBar = { SetupNavBar(onBack = onBack, onNext = onNext, nextLabel = "Continue") },
+ stepLabel = stringResource(R.string.step_2_of_4),
+ title = stringResource(R.string.configure_vm),
+ description = stringResource(R.string.vm_config_description),
+ bottomBar = { SetupNavBar(onBack = onBack, onNext = onNext, nextLabel = stringResource(R.string.continue_label)) },
) {
- PodroidSectionLabel("Resources")
- PodroidListRow(label = "CPU cores", value = "2")
- PodroidListRow(label = "RAM", value = "512 MB")
+ PodroidSectionLabel(stringResource(R.string.resources))
+ PodroidListRow(label = stringResource(R.string.cpu_cores), value = "2")
+ PodroidListRow(label = stringResource(R.string.ram_label), value = "512 MB")
- PodroidSectionLabel("Network")
+ PodroidSectionLabel(stringResource(R.string.network_label))
PodroidListRow(
- label = "SSH access",
+ label = stringResource(R.string.ssh_access),
rightSlot = { PodroidSwitch(checked = sshEnabled, onCheckedChange = onSshToggle) },
divider = false,
)
if (sshEnabled) {
Spacer(Modifier.height(PodroidTokens.Spacing.XS))
Text(
- text = "ssh root@<phone-ip> -p 9922 (password: podroid)",
+ text = stringResource(R.string.ssh_password_hint),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
fontFamily = PodroidTokens.mono(),
@@ -405,31 +407,31 @@ private fun StorageAccessPage(
SetupPageLayout(
windowSizeClass = windowSizeClass,
- stepLabel = "Step 3 of 4",
- title = "Downloads Sharing",
- description = "Optional. Mount your Android Downloads folder into the VM over virtio-9p.",
- bottomBar = { SetupNavBar(onBack = onBack, onNext = onNext, nextLabel = "Continue") },
+ stepLabel = stringResource(R.string.step_3_of_4),
+ title = stringResource(R.string.downloads_sharing),
+ description = stringResource(R.string.storage_access_description),
+ bottomBar = { SetupNavBar(onBack = onBack, onNext = onNext, nextLabel = stringResource(R.string.continue_label)) },
) {
- PodroidSectionLabel("Sharing")
+ PodroidSectionLabel(stringResource(R.string.sharing))
PodroidListRow(
- label = "Enable Downloads sharing",
+ label = stringResource(R.string.enable_downloads_sharing),
rightSlot = { PodroidSwitch(checked = storageAccessEnabled, onCheckedChange = onStorageAccessToggle) },
)
if (!canManageAllFiles) {
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
Text(
- text = "Requires Android 11+. On this device the toggle is for future-OS upgrades only.",
+ text = stringResource(R.string.requires_android_11),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
if (storageAccessEnabled && canManageAllFiles && !hasStoragePermission) {
Spacer(Modifier.height(PodroidTokens.Spacing.LG))
- PodroidPrimaryButton(text = "Grant storage access", onClick = onOpenStorageAccessSettings)
+ PodroidPrimaryButton(text = stringResource(R.string.grant_storage_access), onClick = onOpenStorageAccessSettings)
}
Spacer(Modifier.height(PodroidTokens.Spacing.LG))
Text(
- text = "Warning: on some devices this can crash the VM. Disable it if start fails.",
+ text = stringResource(R.string.storage_access_warning),
style = MaterialTheme.typography.bodyMedium,
color = PodroidTokens.Amber,
)
@@ -449,15 +451,14 @@ private fun UsbPassthroughPage(
) {
SetupPageLayout(
windowSizeClass = windowSizeClass,
- stepLabel = "Step 4 of 4",
- title = "USB Passthrough",
- description = "Optional. Hot-plug external USB devices (Wi-Fi, storage, serial, etc.) " +
- "into the VM at runtime.",
- bottomBar = { SetupNavBar(onBack = onBack, onNext = onGetStarted, nextLabel = "Get Started") },
+ stepLabel = stringResource(R.string.step_4_of_4),
+ title = stringResource(R.string.usb_passthrough),
+ description = stringResource(R.string.usb_passthrough_description),
+ bottomBar = { SetupNavBar(onBack = onBack, onNext = onGetStarted, nextLabel = stringResource(R.string.get_started)) },
) {
- PodroidSectionLabel("Devices")
+ PodroidSectionLabel(stringResource(R.string.usb_devices_section))
PodroidListRow(
- label = "Enable USB passthrough",
+ label = stringResource(R.string.enable_usb_passthrough),
rightSlot = {
PodroidSwitch(
checked = usbPassthroughEnabled && available,
@@ -469,13 +470,9 @@ private fun UsbPassthroughPage(
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
Text(
text = if (available) {
- "Each device asks for permission when you plug it in. Adds a USB " +
- "controller to the VM, which costs a little emulation overhead, " +
- "so leave it off if you don't need it. You can change this later in Settings."
+ stringResource(R.string.usb_passthrough_available)
} else {
- "Not available on this backend: USB passthrough needs QEMU's control " +
- "socket, which the AVF backend doesn't provide. You can change this " +
- "later in Settings."
+ stringResource(R.string.usb_passthrough_unavailable)
},
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
@@ -488,7 +485,7 @@ private fun UsbPassthroughPage(
@Composable
private fun SetupNextBar(onNext: () -> Unit) {
Column(modifier = Modifier.padding(vertical = PodroidTokens.Spacing.LG)) {
- PodroidPrimaryButton(text = "Continue", onClick = onNext)
+ PodroidPrimaryButton(text = stringResource(R.string.continue_label), onClick = onNext)
}
}
@@ -504,7 +501,7 @@ private fun SetupNavBar(
.padding(vertical = PodroidTokens.Spacing.LG),
horizontalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM),
) {
- PodroidGhostButton(text = "Back", onClick = onBack, modifier = Modifier.weight(1f))
+ PodroidGhostButton(text = stringResource(R.string.back), onClick = onBack, modifier = Modifier.weight(1f))
PodroidPrimaryButton(text = nextLabel, onClick = onNext, modifier = Modifier.weight(2f))
}
}
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalScreen.kt b/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalScreen.kt
index 3da54ce..80b1a3a 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalScreen.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalScreen.kt
@@ -97,12 +97,14 @@ import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
+import com.excp.podroid.R
import com.excp.podroid.engine.VmState
import com.excp.podroid.ui.components.AdaptiveContainer
import com.excp.podroid.ui.components.PodroidGhostButton
@@ -186,7 +188,7 @@ fun TerminalScreen(
.windowInsetsPadding(WindowInsets.ime)
) {
PodroidTopBar(
- title = "Terminal",
+ title = stringResource(R.string.terminal_title),
navigationIcon = {
IconButton(onClick = {
val imm = context.getSystemService(android.content.Context.INPUT_METHOD_SERVICE)
@@ -196,7 +198,7 @@ fun TerminalScreen(
}
onNavigateBack()
}) {
- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
}
},
actions = {
@@ -205,7 +207,7 @@ fun TerminalScreen(
}
Spacer(Modifier.width(PodroidTokens.Spacing.XS))
IconButton(onClick = { viewModel.openQuickSettings() }) {
- Icon(Icons.Default.Tune, contentDescription = "Quick settings")
+ Icon(Icons.Default.Tune, contentDescription = stringResource(R.string.settings))
}
},
)
@@ -215,13 +217,13 @@ fun TerminalScreen(
Box(modifier = Modifier.weight(1f).fillMaxWidth(), contentAlignment = Alignment.Center) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text(
- text = "Stopped",
+ text = stringResource(R.string.status_stopped),
style = MaterialTheme.typography.displayLarge,
color = MaterialTheme.colorScheme.onSurface,
)
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
Text(
- "Start the VM from the Home screen first.",
+ stringResource(R.string.vm_not_running_hint),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
@@ -236,7 +238,7 @@ fun TerminalScreen(
modifier = Modifier.padding(horizontal = PodroidTokens.Spacing.XL),
) {
Text(
- text = "Error",
+ text = stringResource(R.string.error_title),
style = MaterialTheme.typography.displayLarge,
color = MaterialTheme.colorScheme.error,
)
@@ -249,7 +251,7 @@ fun TerminalScreen(
)
Spacer(Modifier.height(PodroidTokens.Spacing.LG))
PodroidGhostButton(
- text = "Back to Home",
+ text = stringResource(R.string.back_to_home),
onClick = onNavigateBack,
modifier = Modifier.fillMaxWidth(0.6f),
)
@@ -260,7 +262,7 @@ fun TerminalScreen(
is VmState.Starting -> {
Box(modifier = Modifier.weight(1f).fillMaxWidth(), contentAlignment = Alignment.Center) {
Text(
- text = "Starting…",
+ text = stringResource(R.string.status_starting) + "…",
style = MaterialTheme.typography.displayLarge,
color = MaterialTheme.colorScheme.tertiary,
)
@@ -635,7 +637,7 @@ private fun QuickSettingsDialog(
// ── Sub-dialogs unchanged ───────────────────────────────────────
if (showThemePicker) {
FullPickerDialog(
- title = "Color themes",
+ title = stringResource(R.string.color_themes),
items = themes, selected = colorTheme,
onPick = { onColorThemeChange(it); showThemePicker = false; onDismiss() },
onDismiss = { showThemePicker = false },
@@ -645,13 +647,13 @@ private fun QuickSettingsDialog(
ThemeSwatch(name, sel, click, longClick, viewModel)
},
extraTrailingChip = {
- AddSwatch(label = "Import", subLabel = "Paste URL", onClick = { showThemeImport = true })
+ AddSwatch(label = stringResource(R.string.import_label), subLabel = stringResource(R.string.paste_url), onClick = { showThemeImport = true })
},
)
}
if (showFontPicker) {
FullPickerDialog(
- title = "Fonts",
+ title = stringResource(R.string.fonts),
items = fonts, selected = terminalFont,
onPick = { onFontChange(it); showFontPicker = false; onDismiss() },
onDismiss = { showFontPicker = false },
@@ -661,7 +663,7 @@ private fun QuickSettingsDialog(
FontSwatch(name, viewModel.isCustomFont(name), sel, click, longClick, viewModel)
},
extraTrailingChip = {
- AddSwatch(label = "+ Add", subLabel = ".ttf", onClick = { fontImport.launch(fontMimes) })
+ AddSwatch(label = stringResource(R.string.add_btn), subLabel = ".ttf", onClick = { fontImport.launch(fontMimes) })
},
)
}
@@ -675,29 +677,29 @@ private fun QuickSettingsDialog(
fontToDelete?.let { name ->
AlertDialog(
onDismissRequest = { fontToDelete = null },
- title = { Text("Remove font?") },
- text = { Text("\"${prettyName(name)}\" will be deleted.") },
+ title = { Text(stringResource(R.string.remove_font_question)) },
+ text = { Text(stringResource(R.string.item_will_be_deleted, prettyName(name))) },
confirmButton = {
TextButton(onClick = {
if (viewModel.deleteCustomFont(name)) { if (terminalFont == name) onFontChange("default"); bump++ }
fontToDelete = null
- }) { Text("Delete") }
+ }) { Text(stringResource(R.string.delete_label)) }
},
- dismissButton = { TextButton(onClick = { fontToDelete = null }) { Text("Cancel") } },
+ dismissButton = { TextButton(onClick = { fontToDelete = null }) { Text(stringResource(R.string.cancel)) } },
)
}
themeToDelete?.let { name ->
AlertDialog(
onDismissRequest = { themeToDelete = null },
- title = { Text("Remove theme?") },
- text = { Text("\"${prettyName(name)}\" will be deleted.") },
+ title = { Text(stringResource(R.string.remove_theme_question)) },
+ text = { Text(stringResource(R.string.item_will_be_deleted, prettyName(name))) },
confirmButton = {
TextButton(onClick = {
if (viewModel.deleteCustomTheme(name)) { if (colorTheme == name) onColorThemeChange("default"); bump++ }
themeToDelete = null
- }) { Text("Delete") }
+ }) { Text(stringResource(R.string.delete_label)) }
},
- dismissButton = { TextButton(onClick = { themeToDelete = null }) { Text("Cancel") } },
+ dismissButton = { TextButton(onClick = { themeToDelete = null }) { Text(stringResource(R.string.cancel)) } },
)
}
@@ -749,17 +751,17 @@ private fun QuickSettingsDialog(
// Header
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
- "Settings",
+ stringResource(R.string.settings),
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Medium,
modifier = Modifier.weight(1f),
)
IconButton(onClick = onDismiss, modifier = Modifier.size(36.dp)) {
- Icon(Icons.Default.Close, contentDescription = "Close")
+ Icon(Icons.Default.Close, contentDescription = stringResource(R.string.close))
}
}
- PodroidSectionLabel("Display")
+ PodroidSectionLabel(stringResource(R.string.display_section))
// Size slider — sliding doesn't dismiss (you want to adjust),
// but releasing the thumb does (matches the "any interaction
@@ -769,7 +771,7 @@ private fun QuickSettingsDialog(
modifier = Modifier.fillMaxWidth().padding(vertical = PodroidTokens.Spacing.SM),
) {
Text(
- "Size",
+ stringResource(R.string.size_label),
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.width(56.dp),
)
@@ -797,21 +799,21 @@ private fun QuickSettingsDialog(
// onDismiss to close the drawer.
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
PodroidGhostButton(
- text = "Theme · ${prettyName(colorTheme)}",
+ text = stringResource(R.string.theme_with_value, prettyName(colorTheme)),
onClick = { showThemePicker = true },
)
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
PodroidGhostButton(
- text = "Font · ${prettyName(terminalFont)}",
+ text = stringResource(R.string.font_with_value, prettyName(terminalFont)),
onClick = { showFontPicker = true },
)
- PodroidSectionLabel("Input")
+ PodroidSectionLabel(stringResource(R.string.input_section))
// Toggles — flipping any of these dismisses the drawer
// immediately so the terminal is unblocked.
PodroidListRow(
- label = "Extra keys",
+ label = stringResource(R.string.extra_keys),
rightSlot = {
PodroidSwitch(
checked = showExtraKeys,
@@ -820,7 +822,7 @@ private fun QuickSettingsDialog(
},
)
PodroidListRow(
- label = "Haptics",
+ label = stringResource(R.string.haptics),
rightSlot = {
PodroidSwitch(
checked = hapticsEnabled,
@@ -1002,13 +1004,13 @@ private fun FullPickerDialog(
fontWeight = FontWeight.Medium,
modifier = Modifier.weight(1f))
IconButton(onClick = onDismiss, modifier = Modifier.size(36.dp)) {
- Icon(Icons.Default.Close, contentDescription = "Close")
+ Icon(Icons.Default.Close, contentDescription = stringResource(R.string.close))
}
}
OutlinedTextField(
value = query,
onValueChange = { query = it },
- placeholder = { Text("Search ${items.size}") },
+ placeholder = { Text(stringResource(R.string.search_n_items, items.size)) },
leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
singleLine = true,
modifier = Modifier.fillMaxWidth().padding(top = 8.dp),
@@ -1055,14 +1057,15 @@ private fun ThemeImportDialog(
var busy by remember { mutableStateOf(false) }
var error by remember { mutableStateOf<String?>(null) }
val scope = rememberCoroutineScope()
+ val importErrorMsg = stringResource(R.string.import_theme_error)
AlertDialog(
onDismissRequest = { if (!busy) onDismiss() },
- title = { Text("Import theme") },
+ title = { Text(stringResource(R.string.import_theme)) },
text = {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(
- "Paste a terminalcolors.com theme URL.",
+ stringResource(R.string.import_theme_hint),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
@@ -1092,13 +1095,13 @@ private fun ThemeImportDialog(
val name = viewModel.importThemeFromUrl(url)
busy = false
if (name != null) onImported(name)
- else error = "Couldn't import — check the URL."
+ else error = importErrorMsg
}
},
- ) { Text(if (busy) "Importing…" else "Import") }
+ ) { Text(if (busy) stringResource(R.string.importing) else stringResource(R.string.import_label)) }
},
dismissButton = {
- TextButton(onClick = onDismiss, enabled = !busy) { Text("Cancel") }
+ TextButton(onClick = onDismiss, enabled = !busy) { Text(stringResource(R.string.cancel)) }
},
)
}
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/x11/X11Screen.kt b/app/src/main/java/com/excp/podroid/ui/screens/x11/X11Screen.kt
index 1edc8f8..6f28063 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/x11/X11Screen.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/x11/X11Screen.kt
@@ -80,6 +80,7 @@ import androidx.compose.ui.input.pointer.isTertiaryPressed
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.LocalView
+import androidx.compose.ui.res.stringResource
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
@@ -93,6 +94,7 @@ import androidx.compose.ui.unit.sp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.excp.podroid.R
import com.excp.podroid.ui.components.PodroidTopBar
import kotlinx.coroutines.delay
import kotlinx.coroutines.withTimeoutOrNull
@@ -365,41 +367,41 @@ fun X11Screen(
// keyboard, AndroidView (weight=1) shrinks to fill the gap.
.windowInsetsPadding(WindowInsets.ime),
) {
- if (!fullscreen) {
- PodroidTopBar(
- title = "X11",
- navigationIcon = {
- IconButton(onClick = onNavigateBack) {
- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
- }
- },
- actions = {
- IconButton(onClick = { fullscreen = true }) {
- Icon(Icons.Default.Fullscreen, contentDescription = "Fullscreen")
- }
- IconButton(onClick = { showSettings = true }) {
- Icon(Icons.Default.Tune, contentDescription = "Settings")
- }
- IconButton(onClick = {
- focusRequester.requestFocus()
- keyboardController?.show()
- }) {
- Icon(Icons.Default.Keyboard, contentDescription = "Keyboard")
- }
- IconButton(onClick = onNavigateToTerminal) {
- Icon(
- Icons.Default.DesktopWindows,
- contentDescription = "Terminal",
- tint = MaterialTheme.colorScheme.primary,
- )
- }
- },
- )
- }
+ if (!fullscreen) {
+ PodroidTopBar(
+ title = stringResource(R.string.x11_title),
+ navigationIcon = {
+ IconButton(onClick = onNavigateBack) {
+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
+ }
+ },
+ actions = {
+ IconButton(onClick = { fullscreen = true }) {
+ Icon(Icons.Default.Fullscreen, contentDescription = stringResource(R.string.fullscreen))
+ }
+ IconButton(onClick = { showSettings = true }) {
+ Icon(Icons.Default.Tune, contentDescription = stringResource(R.string.settings))
+ }
+ IconButton(onClick = {
+ focusRequester.requestFocus()
+ keyboardController?.show()
+ }) {
+ Icon(Icons.Default.Keyboard, contentDescription = stringResource(R.string.keyboard))
+ }
+ IconButton(onClick = onNavigateToTerminal) {
+ Icon(
+ Icons.Default.DesktopWindows,
+ contentDescription = stringResource(R.string.terminal),
+ tint = MaterialTheme.colorScheme.primary,
+ )
+ }
+ },
+ )
+ }
- if (showSettings) {
- X11SettingsSheet(viewModel = viewModel, onDismiss = { showSettings = false })
- }
+ if (showSettings) {
+ X11SettingsSheet(viewModel = viewModel, onDismiss = { showSettings = false })
+ }
when (val state = connection) {
X11ConnectionState.Connecting,
@@ -407,7 +409,7 @@ fun X11Screen(
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
CircularProgressIndicator(color = MaterialTheme.colorScheme.primary)
Text(
- "Connecting to X11 server...",
+ stringResource(R.string.x11_connecting),
modifier = Modifier.padding(top = 80.dp),
color = Color.White,
)
@@ -416,7 +418,7 @@ fun X11Screen(
is X11ConnectionState.Failed -> {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text(
- "X11 server not ready — VM still booting?\n${state.message}",
+ "${stringResource(R.string.x11_not_ready)}\n${state.message}",
color = MaterialTheme.colorScheme.error,
)
}
@@ -454,30 +456,30 @@ fun X11Screen(
val event = awaitPointerEvent()
val change = event.changes.firstOrNull() ?: continue
- // Physical-mouse scroll wheel → X wheel (buttons 4/5).
- if (event.type == PointerEventType.Scroll) {
- val dy = change.scrollDelta.y
- if (dy != 0f) {
- viewModel.moveTo(fbX(change.position.x), fbY(change.position.y))
- viewModel.scroll(up = dy < 0f, ticks = abs(dy).toInt().coerceAtLeast(1))
+ // Physical-mouse scroll wheel → X wheel (buttons 4/5).
+ if (event.type == PointerEventType.Scroll) {
+ val dy = change.scrollDelta.y
+ if (dy != 0f) {
+ viewModel.moveTo(fbX(change.position.x), fbY(change.position.y))
+ viewModel.scroll(up = dy < 0f, ticks = abs(dy).toInt().coerceAtLeast(1))
+ }
+ event.changes.forEach { it.consume() }
+ continue
}
- event.changes.forEach { it.consume() }
- continue
- }
- // Physical mouse → absolute move + native buttons.
- // Consuming keeps right-click from falling through to
- // Android Back (which exited fullscreen) and sends it
- // to X as button 3 instead.
- if (change.type == PointerType.Mouse) {
- var mask = 0
- if (event.buttons.isPrimaryPressed) mask = mask or VncClient.BTN_LEFT
- if (event.buttons.isSecondaryPressed) mask = mask or VncClient.BTN_RIGHT
- if (event.buttons.isTertiaryPressed) mask = mask or VncClient.BTN_MIDDLE
- viewModel.mouseUpdate(fbX(change.position.x), fbY(change.position.y), mask)
- event.changes.forEach { it.consume() }
- continue
- }
+ // Physical mouse → absolute move + native buttons.
+ // Consuming keeps right-click from falling through to
+ // Android Back (which exited fullscreen) and sends it
+ // to X as button 3 instead.
+ if (change.type == PointerType.Mouse) {
+ var mask = 0
+ if (event.buttons.isPrimaryPressed) mask = mask or VncClient.BTN_LEFT
+ if (event.buttons.isSecondaryPressed) mask = mask or VncClient.BTN_RIGHT
+ if (event.buttons.isTertiaryPressed) mask = mask or VncClient.BTN_MIDDLE
+ viewModel.mouseUpdate(fbX(change.position.x), fbY(change.position.y), mask)
+ event.changes.forEach { it.consume() }
+ continue
+ }
// Touch → finger-gesture state machine (one gesture).
if (change.type != PointerType.Touch || !change.changedToDown()) continue
@@ -516,7 +518,7 @@ fun X11Screen(
continue
}
- if (s.touchMode == TouchMode.DIRECT) viewModel.moveTo(fbX(sx), fbY(sy))
+ if (s.touchMode == TouchMode.DIRECT) viewModel.moveTo(fbX(sx), fbY(sy))
// Long-press (single finger, no move, ~500ms) => drag-lock.
var outcome = "move"
@@ -666,13 +668,13 @@ fun X11Screen(
},
)
- if (s.showExtraKeys && !fullscreen) {
- X11ExtraKeysRow(
- onKey = ::onExtraKey,
- ctrlActive = ctrlActive,
- altActive = altActive,
- )
- }
+ if (s.showExtraKeys && !fullscreen) {
+ X11ExtraKeysRow(
+ onKey = ::onExtraKey,
+ ctrlActive = ctrlActive,
+ altActive = altActive,
+ )
+ }
// Hidden IME hook (must stay in the layout while connected so
// the requestFocus/show sequence has a target).
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/x11/X11SettingsSheet.kt b/app/src/main/java/com/excp/podroid/ui/screens/x11/X11SettingsSheet.kt
index 4bdbc9b..5bdf7e3 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/x11/X11SettingsSheet.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/x11/X11SettingsSheet.kt
@@ -28,6 +28,7 @@ import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Slider
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
+import androidx.compose.ui.res.stringResource
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -47,6 +48,7 @@ import com.excp.podroid.x11.ResolutionMode
import com.excp.podroid.x11.ResolutionPreset
import com.excp.podroid.x11.RotationLock
import com.excp.podroid.x11.TouchMode
+import com.excp.podroid.R
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@@ -60,7 +62,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
.verticalScroll(rememberScrollState()),
) {
// ── RESOLUTION ────────────────────────────────────────────
- PodroidSectionLabel("Resolution")
+ PodroidSectionLabel(stringResource(R.string.resolution))
Row(
horizontalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM),
@@ -73,9 +75,9 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
label = {
Text(
when (mode) {
- ResolutionMode.MATCH -> "Match viewport"
- ResolutionMode.PRESET -> "Preset"
- ResolutionMode.CUSTOM -> "Custom"
+ ResolutionMode.MATCH -> stringResource(R.string.match_viewport)
+ ResolutionMode.PRESET -> stringResource(R.string.preset)
+ ResolutionMode.CUSTOM -> stringResource(R.string.custom_resolution)
}
)
},
@@ -98,10 +100,10 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
label = {
Text(
when (preset) {
- ResolutionPreset.R720P -> "720p"
- ResolutionPreset.R900P -> "900p"
- ResolutionPreset.R1080P -> "1080p"
- ResolutionPreset.R1440P -> "1440p"
+ ResolutionPreset.R720P -> stringResource(R.string.res_720p)
+ ResolutionPreset.R900P -> stringResource(R.string.res_900p)
+ ResolutionPreset.R1080P -> stringResource(R.string.res_1080p)
+ ResolutionPreset.R1440P -> stringResource(R.string.res_1440p)
}
)
},
@@ -122,7 +124,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
}
// ── ROTATION ──────────────────────────────────────────────
- PodroidSectionLabel("Rotation")
+ PodroidSectionLabel(stringResource(R.string.rotation))
Row(
horizontalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM),
@@ -135,9 +137,9 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
label = {
Text(
when (lock) {
- RotationLock.AUTO -> "Auto"
- RotationLock.LANDSCAPE -> "Landscape"
- RotationLock.PORTRAIT -> "Portrait"
+ RotationLock.AUTO -> stringResource(R.string.auto_rotation)
+ RotationLock.LANDSCAPE -> stringResource(R.string.landscape)
+ RotationLock.PORTRAIT -> stringResource(R.string.portrait)
}
)
},
@@ -148,7 +150,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
}
// ── TOUCH ─────────────────────────────────────────────────
- PodroidSectionLabel("Touch")
+ PodroidSectionLabel(stringResource(R.string.touch))
Row(
horizontalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM),
@@ -158,7 +160,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
FilterChip(
selected = s.touchMode == mode,
onClick = { viewModel.setTouchMode(mode) },
- label = { Text(if (mode == TouchMode.DIRECT) "Direct touch" else "Trackpad") },
+ label = { Text(if (mode == TouchMode.DIRECT) stringResource(R.string.direct_touch) else stringResource(R.string.trackpad)) },
shape = RoundedCornerShape(PodroidTokens.Radius.Chip),
colors = PodroidChipColors(),
)
@@ -167,7 +169,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
Text(
- "Pointer speed: ${"%.1f".format(s.trackpadSensitivity)}x",
+ "${stringResource(R.string.pointer_speed)}: ${"%.1f".format(s.trackpadSensitivity)}x",
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Slider(
@@ -182,7 +184,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
- Text("Pointer acceleration", color = MaterialTheme.colorScheme.onSurface)
+ Text(stringResource(R.string.pointer_acceleration), color = MaterialTheme.colorScheme.onSurface)
PodroidSwitch(
checked = s.trackpadAccel,
onCheckedChange = { viewModel.setTrackpadAccel(it) },
@@ -191,14 +193,14 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
}
// ── DISPLAY ───────────────────────────────────────────────
- PodroidSectionLabel("Display")
+ PodroidSectionLabel(stringResource(R.string.display))
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
- Text("Show extra keys", color = MaterialTheme.colorScheme.onSurface)
+ Text(stringResource(R.string.show_extra_keys), color = MaterialTheme.colorScheme.onSurface)
PodroidSwitch(
checked = s.showExtraKeys,
onCheckedChange = { viewModel.setShowExtraKeys(it) },
@@ -210,7 +212,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
- Text("Start in fullscreen", color = MaterialTheme.colorScheme.onSurface)
+ Text(stringResource(R.string.start_fullscreen), color = MaterialTheme.colorScheme.onSurface)
PodroidSwitch(
checked = s.fullscreenDefault,
onCheckedChange = { viewModel.setFullscreenDefault(it) },
@@ -218,7 +220,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
}
Spacer(Modifier.height(PodroidTokens.Spacing.SM))
- Text("Server DPI", color = MaterialTheme.colorScheme.onSurface)
+ Text(stringResource(R.string.server_dpi), color = MaterialTheme.colorScheme.onSurface)
Spacer(Modifier.height(PodroidTokens.Spacing.XS))
Row(
horizontalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM),
@@ -235,7 +237,7 @@ fun X11SettingsSheet(viewModel: X11ViewModel, onDismiss: () -> Unit) {
}
}
Text(
- "Applies on next VM start",
+ stringResource(R.string.applies_on_next_vm_start),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
@@ -271,7 +273,7 @@ private fun CustomResolutionFields(
OutlinedTextField(
value = wText,
onValueChange = { wText = it },
- label = { Text("Width") },
+ label = { Text(stringResource(R.string.width)) },
singleLine = true,
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number, imeAction = ImeAction.Done),
keyboardActions = KeyboardActions(onDone = { commit() }),
@@ -282,7 +284,7 @@ private fun CustomResolutionFields(
OutlinedTextField(
value = hText,
onValueChange = { hText = it },
- label = { Text("Height") },
+ label = { Text(stringResource(R.string.height)) },
singleLine = true,
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number, imeAction = ImeAction.Done),
keyboardActions = KeyboardActions(onDone = { commit() }),
diff --git a/app/src/main/java/com/excp/podroid/ui/theme/Language.kt b/app/src/main/java/com/excp/podroid/ui/theme/Language.kt
new file mode 100644
index 0000000..8ae9286
--- /dev/null
+++ b/app/src/main/java/com/excp/podroid/ui/theme/Language.kt
@@ -0,0 +1,14 @@
+/*
+ * Podroid - Rootless Podman for Android
+ * Copyright (C) 2024-2026 Podroid contributors
+ */
+package com.excp.podroid.ui.theme
+
+import androidx.compose.runtime.compositionLocalOf
+
+/**
+ * Provides the current language code (e.g., "zh", "en") to Compose components.
+ * Note: Language is now managed by Android's resource system automatically,
+ * so this LocalLanguage is primarily for programmatic language detection.
+ */
+val LocalLanguage = compositionLocalOf<String> { "en" }
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
new file mode 100644
index 0000000..82ef248
--- /dev/null
+++ b/app/src/main/res/values-zh/strings.xml
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Podroid - Rootless Podman for Android
+ Copyright (C) 2024-2026 Podroid contributors
+-->
+<resources>
+ <string name="app_name">Podroid</string>
+
+ <!-- VM Status -->
+ <string name="vm_status">虚拟机状态</string>
+ <string name="status_starting">启动中</string>
+ <string name="status_running">运行中</string>
+ <string name="status_stopped">已停止</string>
+ <string name="status_idle">空闲</string>
+
+ <!-- Network -->
+ <string name="network">网络</string>
+ <string name="phone_ip">手机 IP</string>
+ <string name="ssh">SSH</string>
+ <string name="port_forwards">端口转发</string>
+
+ <!-- Last Session -->
+ <string name="last_session">上次会话</string>
+ <string name="booted_in">启动耗时</string>
+ <string name="build">版本</string>
+
+ <!-- Actions -->
+ <string name="settings">设置</string>
+ <string name="open_terminal">打开终端</string>
+ <string name="restart">重启</string>
+ <string name="stop">停止</string>
+ <string name="start_vm">启动虚拟机</string>
+ <string name="download">下载</string>
+ <string name="later">稍后</string>
+ <string name="dismiss">关闭</string>
+ <string name="back">返回</string>
+ <string name="continue_label">继续</string>
+ <string name="get_started">开始使用</string>
+
+ <!-- Storage -->
+ <string name="persistent_storage">持久化存储</string>
+ <string name="storage_description">用于安装的软件包、容器镜像和您的文件。不重置虚拟机则无法调整大小。</string>
+
+ <!-- VM Config -->
+ <string name="configure_vm">配置您的虚拟机</string>
+ <string name="vm_config_description">默认配置针对性能和电池进行了优化。随时可在设置中更改。</string>
+ <string name="resources">资源</string>
+ <string name="cpu_cores">CPU 核心数</string>
+ <string name="ram_label">内存</string>
+ <string name="network_label">网络</string>
+ <string name="ssh_access">SSH 访问</string>
+ <string name="ssh_password_hint">ssh root@&lt;手机-ip&gt; -p 9922 (密码: podroid)</string>
+
+ <!-- Storage Access -->
+ <string name="downloads_sharing">下载文件夹共享</string>
+ <string name="storage_access_description">可选。通过 virtio-9p 将 Android 下载文件夹挂载到虚拟机。</string>
+ <string name="enable_downloads_sharing">启用下载文件夹共享</string>
+ <string name="grant_storage_access">授予存储权限</string>
+ <string name="requires_android_11">需要 Android 11+。在此设备上,此开关仅用于未来系统升级。</string>
+ <string name="storage_access_warning">警告:某些设备上这可能导致虚拟机崩溃。如果启动失败,请禁用。</string>
+
+ <!-- Settings Sections -->
+ <string name="appearance">外观</string>
+ <string name="dark_theme">深色主题</string>
+ <string name="dynamic_color">动态颜色(Material You)</string>
+ <string name="vm_resources">虚拟机资源</string>
+ <string name="stop_vm_to_change">停止虚拟机后才能更改这些设置。</string>
+ <string name="storage">存储</string>
+ <string name="reset_vm">重置虚拟机(删除所有数据)</string>
+ <string name="reset_vm_description">完全重置应用?</string>
+ <string name="reset_vm_text">这将清除所有应用数据,包括虚拟机存储、设置和端口规则。应用将关闭并恢复到刚安装时的状态。</string>
+ <string name="reset_everything">全部重置</string>
+ <string name="cancel">取消</string>
+ <string name="advanced">高级</string>
+ <string name="hide_advanced">隐藏高级选项</string>
+ <string name="show_advanced">显示高级选项</string>
+ <string name="backend">后端</string>
+ <string name="auto">自动</string>
+ <string name="avf_kvm">AVF (KVM)</string>
+ <string name="qemu_tcg">QEMU (TCG)</string>
+ <string name="extra_qemu_args">额外的 QEMU 参数</string>
+ <string name="extra_kernel_cmdline">额外的内核命令行</string>
+ <string name="kernel_cmdline_helper">在 console=ttyAMA0 之后追加 - 控制调度器、缓解措施、日志级别等。</string>
+ <string name="qemu_args_helper">-cpu, -accel, -object, -device, -overcommit 等。空格分隔。</string>
+ <string name="about">关于</string>
+ <string name="architecture">架构</string>
+ <string name="linux_distro">Linux 发行版</string>
+ <string name="export_diagnostic_log">导出诊断日志</string>
+ <string name="avf_diagnostic">AVF (pKVM) 诊断</string>
+ <string name="running_avf_diagnostic">运行 AVF 诊断…</string>
+ <string name="verbose_avf_logging">详细 AVF 日志</string>
+ <string name="close">关闭</string>
+ <string name="add_port_forward">添加端口转发</string>
+ <string name="android_port">Android 端口</string>
+ <string name="vm_port">虚拟机端口</string>
+ <string name="e_g_8080">例如:8080</string>
+ <string name="e_g_80">例如:80</string>
+ <string name="tcp">TCP</string>
+ <string name="udp">UDP</string>
+ <string name="both">两者</string>
+ <string name="enter_valid_ports">输入有效的端口号 (1-65535)</string>
+ <string name="reset">重置</string>
+ <string name="remove">删除</string>
+ <string name="port_forwards_count">端口转发 ({count})</string>
+ <string name="none">无</string>
+ <string name="active">活动</string>
+ <string name="off">关闭</string>
+ <string name="up">运行中</string>
+
+ <!-- AVF Hint -->
+ <string name="avf_available">此设备支持 AVF (KVM)</string>
+ <string name="avf_hint_needs_pc">需要 PC 上的 adb,或设备上的 Shizuku 应用进行授权。运行一次:</string>
+ <string name="avf_grant_commands">adb shell pm grant com.excp.podroid \\\n android.permission.MANAGE_VIRTUAL_MACHINE\nadb shell pm grant com.excp.podroid \\\n android.permission.USE_CUSTOM_VIRTUAL_MACHINE</string>
+
+ <!-- Setup Steps -->
+ <string name="step_1_of_4">第 1 步,共 4 步</string>
+ <string name="step_2_of_4">第 2 步,共 4 步</string>
+ <string name="step_3_of_4">第 3 步,共 4 步</string>
+ <string name="step_4_of_4">第 4 步,共 4 步</string>
+
+ <!-- Dialogs -->
+ <string name="update_available">有新版本可用</string>
+ <string name="version_available">版本 %1$s 可用。当前版本 %2$s。</string>
+
+ <!-- Language -->
+ <string name="language_label">语言</string>
+ <string name="system_default">系统默认</string>
+ <string name="language_zh">中文 (Chinese)</string>
+ <string name="language_en">English</string>
+
+ <!-- Error -->
+ <string name="error_title">错误</string>
+ <string name="try_again">重试</string>
+
+ <!-- Sharing -->
+ <string name="sharing">共享</string>
+
+ <!-- Terminal -->
+ <string name="paste_text">粘贴</string>
+ <string name="copy_text">复制</string>
+ <string name="text_selection_more">更多…</string>
+ <string name="terminal_title">终端</string>
+ <string name="vm_not_running_hint">请先从主屏幕启动虚拟机。</string>
+ <string name="back_to_home">返回主屏幕</string>
+
+ <!-- Terminal Quick Settings -->
+ <string name="display_section">显示</string>
+ <string name="size_label">大小</string>
+ <string name="theme_with_value">主题 · %1$s</string>
+ <string name="font_with_value">字体 · %1$s</string>
+ <string name="input_section">输入</string>
+ <string name="extra_keys">扩展按键</string>
+ <string name="haptics">触觉反馈</string>
+ <string name="color_themes">颜色主题</string>
+ <string name="fonts">字体</string>
+ <string name="import_label">导入</string>
+ <string name="paste_url">粘贴 URL</string>
+ <string name="add_btn">+ 添加</string>
+ <string name="remove_font_question">删除字体?</string>
+ <string name="remove_theme_question">删除主题?</string>
+ <string name="item_will_be_deleted">"%1$s" 将被删除。</string>
+ <string name="delete_label">删除</string>
+ <string name="search_n_items">搜索 %1$d 项</string>
+ <string name="import_theme">导入主题</string>
+ <string name="import_theme_hint">粘贴 terminalcolors.com 主题 URL。</string>
+ <string name="import_theme_error">导入失败 — 请检查 URL。</string>
+ <string name="importing">导入中…</string>
+
+ <!-- X11 -->
+ <string name="x11_title">X11</string>
+ <string name="x11_connecting">正在连接 X11 服务器...</string>
+ <string name="x11_not_ready">X11 服务器未就绪 — 虚拟机是否仍在启动?</string>
+ <string name="fullscreen">全屏</string>
+ <string name="keyboard">键盘</string>
+ <string name="terminal">终端</string>
+ <string name="resolution">分辨率</string>
+ <string name="match_viewport">匹配视口</string>
+ <string name="preset">预设</string>
+ <string name="custom_resolution">自定义</string>
+ <string name="res_720p">720p</string>
+ <string name="res_900p">900p</string>
+ <string name="res_1080p">1080p</string>
+ <string name="res_1440p">1440p</string>
+ <string name="rotation">旋转</string>
+ <string name="auto_rotation">自动</string>
+ <string name="landscape">横屏</string>
+ <string name="portrait">竖屏</string>
+ <string name="touch">触摸</string>
+ <string name="direct_touch">直接触摸</string>
+ <string name="trackpad">触摸板</string>
+ <string name="pointer_speed">指针速度</string>
+ <string name="pointer_acceleration">指针加速度</string>
+ <string name="display">显示</string>
+ <string name="show_extra_keys">显示扩展按键</string>
+ <string name="start_fullscreen">默认全屏启动</string>
+ <string name="server_dpi">服务器 DPI</string>
+ <string name="applies_on_next_vm_start">将在下次虚拟机启动时生效</string>
+ <string name="width">宽度</string>
+ <string name="height">高度</string>
+
+ <!-- Misc -->
+ <string name="add">添加</string>
+ <string name="version_label">版本</string>
+ <string name="qemu_label">QEMU</string>
+ <string name="stop_vm_before_edit">停止虚拟机后才能编辑 — 更改将在下次启动时生效。</string>
+
+ <!-- USB Passthrough -->
+ <string name="usb_passthrough">USB 设备直通</string>
+ <string name="usb_passthrough_description">可选。在虚拟机运行时热插拔外部 USB 设备(Wi-Fi、存储、串口等)。</string>
+ <string name="enable_usb_passthrough">启用 USB 设备直通</string>
+ <string name="usb_devices_section">设备</string>
+ <string name="usb_passthrough_available">插入设备时会询问您的许可。为虚拟机添加 USB 控制器,会带来少量模拟开销,如果不需要可保持关闭。您可在设置中随时更改。</string>
+ <string name="usb_passthrough_unavailable">此后端不可用:USB 设备直通需要 QEMU 控制套接字,而 AVF 后端不提供此功能。您可在设置中随时更改。</string>
+ <string name="usb_passthrough_settings_label">USB 设备直通</string>
+ <string name="usb_passthrough_settings_description_available">在虚拟机中热插拔外部 USB 设备(Wi-Fi、存储、串口等)。设备连接时会询问许可。启动时添加 USB 控制器,因此需要重启虚拟机以应用更改。</string>
+ <string name="usb_passthrough_settings_description_unavailable">${backend} 后端不可用:USB 设备直通需要 QEMU 的 QMP 控制套接字,而 AVF 后端不提供此功能。</string>
+ <string name="downloads_sharing_unavailable">此 ${backend} 构建不可用 - AVF 要求特权系统应用安装(Google 的终端应用通过这种方式绕过);第三方 APK 无法跨越 SELinux 域读取 /storage/emulated/Download。</string>
+</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2376ed9..afa5585 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -5,4 +5,213 @@
-->
<resources>
<string name="app_name">Podroid</string>
+
+ <!-- VM Status -->
+ <string name="vm_status">VM Status</string>
+ <string name="status_starting">Starting</string>
+ <string name="status_running">Running</string>
+ <string name="status_stopped">Stopped</string>
+ <string name="status_idle">Idle</string>
+
+ <!-- Network -->
+ <string name="network">Network</string>
+ <string name="phone_ip">Phone IP</string>
+ <string name="ssh">SSH</string>
+ <string name="port_forwards">Port forwards</string>
+
+ <!-- Last Session -->
+ <string name="last_session">Last session</string>
+ <string name="booted_in">Booted in</string>
+ <string name="build">Build</string>
+
+ <!-- Actions -->
+ <string name="settings">Settings</string>
+ <string name="open_terminal">Open Terminal</string>
+ <string name="restart">Restart</string>
+ <string name="stop">Stop</string>
+ <string name="start_vm">Start VM</string>
+ <string name="download">Download</string>
+ <string name="later">Later</string>
+ <string name="dismiss">Dismiss</string>
+ <string name="back">Back</string>
+ <string name="continue_label">Continue</string>
+ <string name="get_started">Get Started</string>
+
+ <!-- Storage -->
+ <string name="persistent_storage">Persistent Storage</string>
+ <string name="storage_description">Storage for installed packages, container images, and your files. Cannot be resized later without resetting the VM.</string>
+
+ <!-- VM Config -->
+ <string name="configure_vm">Configure your VM</string>
+ <string name="vm_config_description">Defaults tuned for performance and battery. Change anytime in Settings.</string>
+ <string name="resources">Resources</string>
+ <string name="cpu_cores">CPU cores</string>
+ <string name="ram_label">RAM</string>
+ <string name="network_label">Network</string>
+ <string name="ssh_access">SSH access</string>
+ <string name="ssh_password_hint">ssh root@&lt;phone-ip&gt; -p 9922 (password: podroid)</string>
+
+ <!-- Storage Access -->
+ <string name="downloads_sharing">Downloads Sharing</string>
+ <string name="storage_access_description">Optional. Mount your Android Downloads folder into the VM over virtio-9p.</string>
+ <string name="enable_downloads_sharing">Enable Downloads sharing</string>
+ <string name="grant_storage_access">Grant storage access</string>
+ <string name="requires_android_11">Requires Android 11+. On this device the toggle is for future-OS upgrades only.</string>
+ <string name="storage_access_warning">Warning: on some devices this can crash the VM. Disable it if start fails.</string>
+
+ <!-- Settings Sections -->
+ <string name="appearance">Appearance</string>
+ <string name="dark_theme">Dark theme</string>
+ <string name="dynamic_color">Dynamic color (Material You)</string>
+ <string name="vm_resources">VM Resources</string>
+ <string name="stop_vm_to_change">Stop the VM to change these settings.</string>
+ <string name="storage">Storage</string>
+ <string name="reset_vm">Reset VM (deletes all data)</string>
+ <string name="reset_vm_description">Full App Reset?</string>
+ <string name="reset_vm_text">This will clear ALL application data, including your VM storage, settings, and port rules. The app will close and return to a freshly-installed state.</string>
+ <string name="reset_everything">Reset Everything</string>
+ <string name="cancel">Cancel</string>
+ <string name="advanced">Advanced</string>
+ <string name="hide_advanced">Hide advanced</string>
+ <string name="show_advanced">Show advanced</string>
+ <string name="backend">Backend</string>
+ <string name="auto">Auto</string>
+ <string name="avf_kvm">AVF (KVM)</string>
+ <string name="qemu_tcg">QEMU (TCG)</string>
+ <string name="extra_qemu_args">Extra QEMU args</string>
+ <string name="extra_kernel_cmdline">Extra kernel cmdline</string>
+ <string name="kernel_cmdline_helper">Appended after console=ttyAMA0 — controls scheduler, mitigations, log level, etc.</string>
+ <string name="qemu_args_helper">-cpu, -accel, -object, -device, -overcommit, etc. Whitespace-separated.</string>
+ <string name="about">About</string>
+ <string name="architecture">Architecture</string>
+ <string name="linux_distro">Linux distro</string>
+ <string name="export_diagnostic_log">Export diagnostic log</string>
+ <string name="avf_diagnostic">AVF (pKVM) diagnostic</string>
+ <string name="running_avf_diagnostic">Running AVF diagnostic…</string>
+ <string name="verbose_avf_logging">Verbose AVF logging</string>
+ <string name="close">Close</string>
+ <string name="add_port_forward">Add port forward</string>
+ <string name="android_port">Android port</string>
+ <string name="vm_port">VM port</string>
+ <string name="e_g_8080">e.g. 8080</string>
+ <string name="e_g_80">e.g. 80</string>
+ <string name="tcp">TCP</string>
+ <string name="udp">UDP</string>
+ <string name="both">Both</string>
+ <string name="enter_valid_ports">Enter valid port numbers (1–65535)</string>
+ <string name="reset">Reset</string>
+ <string name="remove">Remove</string>
+ <string name="port_forwards_count">Port forwards ({count})</string>
+ <string name="none">None</string>
+ <string name="active">active</string>
+ <string name="off">Off</string>
+ <string name="up">Up</string>
+
+ <!-- AVF Hint -->
+ <string name="avf_available">AVF (KVM) available on this device</string>
+ <string name="avf_hint_needs_pc">Needs a PC with adb, or the Shizuku app for on-device grant. Run once:</string>
+ <string name="avf_grant_commands">adb shell pm grant com.excp.podroid \\\n android.permission.MANAGE_VIRTUAL_MACHINE\nadb shell pm grant com.excp.podroid \\\n android.permission.USE_CUSTOM_VIRTUAL_MACHINE</string>
+
+ <!-- Setup Steps -->
+ <string name="step_1_of_4">Step 1 of 4</string>
+ <string name="step_2_of_4">Step 2 of 4</string>
+ <string name="step_3_of_4">Step 3 of 4</string>
+ <string name="step_4_of_4">Step 4 of 4</string>
+
+ <!-- Dialogs -->
+ <string name="update_available">Update available</string>
+ <string name="version_available">Version %1$s is available. You have %2$s.</string>
+
+ <!-- Language -->
+ <string name="language_label">Language</string>
+ <string name="system_default">System default</string>
+ <string name="language_zh">中文 (Chinese)</string>
+ <string name="language_en">English</string>
+
+ <!-- Error -->
+ <string name="error_title">Error</string>
+ <string name="try_again">Try again</string>
+
+ <!-- Sharing -->
+ <string name="sharing">Sharing</string>
+
+ <!-- Terminal -->
+ <string name="paste_text">Paste</string>
+ <string name="copy_text">Copy</string>
+ <string name="text_selection_more">More…</string>
+ <string name="terminal_title">Terminal</string>
+ <string name="vm_not_running_hint">Start the VM from the Home screen first.</string>
+ <string name="back_to_home">Back to Home</string>
+
+ <!-- Terminal Quick Settings -->
+ <string name="display_section">Display</string>
+ <string name="size_label">Size</string>
+ <string name="theme_with_value">Theme · %1$s</string>
+ <string name="font_with_value">Font · %1$s</string>
+ <string name="input_section">Input</string>
+ <string name="extra_keys">Extra keys</string>
+ <string name="haptics">Haptics</string>
+ <string name="color_themes">Color themes</string>
+ <string name="fonts">Fonts</string>
+ <string name="import_label">Import</string>
+ <string name="paste_url">Paste URL</string>
+ <string name="add_btn">+ Add</string>
+ <string name="remove_font_question">Remove font?</string>
+ <string name="remove_theme_question">Remove theme?</string>
+ <string name="item_will_be_deleted">"%1$s" will be deleted.</string>
+ <string name="delete_label">Delete</string>
+ <string name="search_n_items">Search %1$d</string>
+ <string name="import_theme">Import theme</string>
+ <string name="import_theme_hint">Paste a terminalcolors.com theme URL.</string>
+ <string name="import_theme_error">Couldn\'t import — check the URL.</string>
+ <string name="importing">Importing…</string>
+
+ <!-- X11 -->
+ <string name="x11_title">X11</string>
+ <string name="x11_connecting">Connecting to X11 server...</string>
+ <string name="x11_not_ready">X11 server not ready — VM still booting?</string>
+ <string name="fullscreen">Fullscreen</string>
+ <string name="keyboard">Keyboard</string>
+ <string name="terminal">Terminal</string>
+ <string name="resolution">Resolution</string>
+ <string name="match_viewport">Match viewport</string>
+ <string name="preset">Preset</string>
+ <string name="custom_resolution">Custom</string>
+ <string name="res_720p">720p</string>
+ <string name="res_900p">900p</string>
+ <string name="res_1080p">1080p</string>
+ <string name="res_1440p">1440p</string>
+ <string name="rotation">Rotation</string>
+ <string name="auto_rotation">Auto</string>
+ <string name="landscape">Landscape</string>
+ <string name="portrait">Portrait</string>
+ <string name="touch">Touch</string>
+ <string name="direct_touch">Direct touch</string>
+ <string name="trackpad">Trackpad</string>
+ <string name="pointer_speed">Pointer speed</string>
+ <string name="pointer_acceleration">Pointer acceleration</string>
+ <string name="display">Display</string>
+ <string name="show_extra_keys">Show extra keys</string>
+ <string name="start_fullscreen">Start in fullscreen</string>
+ <string name="server_dpi">Server DPI</string>
+ <string name="applies_on_next_vm_start">Applies on next VM start</string>
+ <string name="width">Width</string>
+ <string name="height">Height</string>
+ <!-- Misc -->
+ <string name="add">Add</string>
+ <string name="version_label">Version</string>
+ <string name="qemu_label">QEMU</string>
+ <string name="stop_vm_before_edit">Stop the VM before editing — changes apply on next boot.</string>
+
+ <!-- USB Passthrough -->
+ <string name="usb_passthrough">USB Passthrough</string>
+ <string name="usb_passthrough_description">Optional. Hot-plug external USB devices (Wi-Fi, storage, serial, etc.) into the VM at runtime.</string>
+ <string name="enable_usb_passthrough">Enable USB passthrough</string>
+ <string name="usb_devices_section">Devices</string>
+ <string name="usb_passthrough_available">Each device asks for permission when you plug it in. Adds a USB controller to the VM, which costs a little emulation overhead, so leave it off if you do not need it. You can change this later in Settings.</string>
+ <string name="usb_passthrough_unavailable">Not available on this backend: USB passthrough needs QEMU control socket, which the AVF backend does not provide. You can change this later in Settings.</string>
+ <string name="usb_passthrough_settings_label">USB passthrough</string>
+ <string name="usb_passthrough_settings_description_available">Hot-plugs external USB devices (Wi-Fi, storage, serial, etc.) into the VM. Each device asks for permission when attached. Adds a USB controller at boot, so restart the VM to apply.</string>
+ <string name="usb_passthrough_settings_description_unavailable">Not available on the ${backend} backend: USB passthrough rides QEMU\'s QMP control socket, which the AVF backend doesn\'t provide.</string>
+ <string name="downloads_sharing_unavailable">Not available on this ${backend} build — AVF requires a privileged system-app install (Google\'s Terminal app cheats this way); third-party APKs can\'t cross SELinux domains to read /storage/emulated/Download.</string>
</resources>
diff --git a/terminal-view/src/main/res/values-zh/strings.xml b/terminal-view/src/main/res/values-zh/strings.xml
new file mode 100644
index 0000000..a553ecb
--- /dev/null
+++ b/terminal-view/src/main/res/values-zh/strings.xml
@@ -0,0 +1,5 @@
+<resources>
+ <string name="paste_text">粘贴</string>
+ <string name="copy_text">复制</string>
+ <string name="text_selection_more">更多…</string>
+</resources>