Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0d39a12
#886 Localisation foundation: string catalog, UiText, CI checks
ivanfenenko Nov 1, 2026
941bfcf
#886 Android: key Active and Back, mirror Back in RTL, uncap lone top…
ivanfenenko Nov 2, 2026
65a6729
#886 iOS: key Active and Back, mirror Back in RTL
ivanfenenko Nov 2, 2026
9e1c41d
#886 iOS: verbatim text in the Playground scenario sheet
ivanfenenko Nov 2, 2026
7feec02
#886 Localisation: Connection and onboarding text
ivanfenenko Nov 2, 2026
911bc42
#886 Localisation: Home, Add Project and worktree text
ivanfenenko Nov 2, 2026
95b00e5
#886 Localisation: Files and Terminal text
ivanfenenko Nov 2, 2026
fdb3f86
#886 Localisation: Session Chat screen and timeline text
ivanfenenko Nov 2, 2026
c89f039
#886 Localisation: Session Chat sheets and Session Context text
ivanfenenko Nov 2, 2026
5ad810a
#886 Localisation: Settings, Diagnostics, Appearance and Feedback text
ivanfenenko Nov 2, 2026
40c1111
#886 Compare resolved English in tests after combining the stack
ivanfenenko Nov 2, 2026
0f7b58c
#886 Localisation: Changes text
ivanfenenko Nov 2, 2026
9eca558
#886 Localisation: Session Chat timeline and tool text
ivanfenenko Nov 2, 2026
78ba524
#886 Localisation: component and shared text
ivanfenenko Nov 2, 2026
7ba44e4
#886 Localisation: one wording on both platforms, count grammar
ivanfenenko Nov 2, 2026
b0ea189
#886 Fix gallery label and tests after stacking the final slices
ivanfenenko Nov 2, 2026
872bab3
#886 Merge the localisation stack into main
ivanfenenko Nov 3, 2026
4f9d26f
#886 Merge main: key the Changes other-source hint and the Recent hint
ivanfenenko Nov 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 46 additions & 0 deletions .github/workflows/string-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: String Checks

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "android/app/src/main/**"
- "ios/OpenCode Mobile/OpenCode Mobile/**"
- "scripts/check-string-keys.mjs"
- "scripts/check-hardcoded-text.mjs"
- ".github/workflows/string-checks.yml"
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
strings:
# GitHub-hosted on purpose: plain Node scripts with no dependencies or secrets.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

# Fails when a key exists on one platform but not the other (#886).
- name: String key parity
run: node scripts/check-string-keys.mjs

# Warning only while existing text is extracted; becomes --strict once done (#886).
- name: Hardcoded text (warning only)
run: |
node scripts/check-hardcoded-text.mjs | tee hardcoded-text.txt
total=$(sed -n 's/^Total: //p' hardcoded-text.txt)
echo "::warning title=Hardcoded text::${total} user-facing literal(s) still in feature code"
{
echo '### Hardcoded text'
echo '```'
cat hardcoded-text.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
10 changes: 10 additions & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,17 @@ android {
}
}

androidResources {
// Lists the app in the system per-app language setting. Needs
// res/resources.properties for the default (unqualified) locale.
generateLocaleConfig = true
}

buildTypes {
debug {
// en-XA (long text) and ar-XB (right-to-left) pseudo-locales for layout checks.
isPseudoLocalesEnabled = true
}
release {
isMinifyEnabled = true
// Resource shrinking stays off until minify is proven on Play-internal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import dev.opencode.mobile.ui.keyboard.KeyboardShortcutHost
import dev.opencode.mobile.ui.keyboard.LocalKeyboardShortcutHost
import dev.opencode.mobile.ui.root.PrivacyCover
import dev.opencode.mobile.ui.root.PrivacyCoverState
import dev.opencode.mobile.ui.text.ResourcesUiTextLookup
import kotlinx.coroutines.launch
import javax.inject.Inject

Expand Down Expand Up @@ -223,7 +224,7 @@ class MainActivity : FragmentActivity() {
deviceId: Int,
) {
super.onProvideKeyboardShortcuts(data, menu, deviceId)
keyboardShortcuts.shortcutGroup()?.let { data?.add(it) }
keyboardShortcuts.shortcutGroup(ResourcesUiTextLookup(resources))?.let { data?.add(it) }
}

private companion object {
Expand Down
16 changes: 11 additions & 5 deletions android/app/src/main/java/dev/opencode/mobile/Navigation.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.opencode.mobile

import android.content.Intent
import androidx.activity.compose.BackHandler
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
Expand Down Expand Up @@ -35,6 +36,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
Expand All @@ -47,6 +49,7 @@ import androidx.navigation3.runtime.entryProvider
import androidx.navigation3.runtime.rememberNavBackStack
import androidx.navigation3.runtime.rememberSaveableStateHolderNavEntryDecorator
import androidx.navigation3.ui.NavDisplay
import dev.opencode.mobile.R
import dev.opencode.mobile.domain.app.AppVersion
import dev.opencode.mobile.domain.connection.ConnectionProfile
import dev.opencode.mobile.domain.feedback.FeedbackScreen
Expand Down Expand Up @@ -303,13 +306,16 @@ fun MainNavigation() {
val diagnosticLogsViewModel: DiagnosticLogsViewModel = hiltViewModel()
val diagnosticLogsState by diagnosticLogsViewModel.state.collectAsStateWithLifecycle()
val context = LocalContext.current
val shareSubject = stringResource(R.string.share_diagnostics_subject)
val shareChooserTitle = stringResource(R.string.share_diagnostics_chooser_title)
DiagnosticLogsScreen(
state = diagnosticLogsState,
onNavigateBack = onNavigateBack,
detailControl = detailControl,
onShareViaApps = {
diagnosticLogsViewModel.shareViaApps { intent ->
context.startActivity(intent)
intent.putExtra(Intent.EXTRA_SUBJECT, shareSubject)
context.startActivity(Intent.createChooser(intent, shareChooserTitle))
}
},
onSaveToUri = diagnosticLogsViewModel::saveToUri,
Expand All @@ -335,8 +341,8 @@ fun MainNavigation() {
AppRootState.Loading -> {
ProductRouteScreenViewEffect(screenId = ProductAnalytics.Screen.APP_LOADING)
OpenCodeStatusStack(
title = "Loading sessions",
subtitle = "Checking server…",
title = stringResource(R.string.common_loading_sessions),
subtitle = stringResource(R.string.common_checking_server),
testTag = "appRootLoading",
modifier = Modifier.fillMaxSize(),
)
Expand Down Expand Up @@ -968,8 +974,8 @@ private fun HomeSessionPane(
Column(modifier = Modifier.fillMaxSize()) {
OpenCodeTopBar(leading = openCodeDetailLeading(currentDetailControl) {})
OpenCodeEmptyState(
title = "No session selected",
message = "Choose a session from the list",
title = stringResource(R.string.home_no_session_selected_title),
message = stringResource(R.string.home_no_session_selected_message),
icon = OpenCodeIcons.List,
modifier =
Modifier
Expand Down
11 changes: 6 additions & 5 deletions android/app/src/main/java/dev/opencode/mobile/NavigationKeys.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ import kotlinx.serialization.Serializable
val worktree: String,
val parentId: String? = null,
val blockID: String,
val title: String,
val subtitle: String? = null,
/** App text or server content, resolved when the route is shown so it follows the app language. */
val title: @Serializable(with = dev.opencode.mobile.ui.sessionchat.UiTextSerializer::class) dev.opencode.mobile.ui.text.UiText,
val subtitle: @Serializable(with = dev.opencode.mobile.ui.sessionchat.UiTextSerializer::class) dev.opencode.mobile.ui.text.UiText? = null,
val messageId: String,
val owningTurnMessageId: String? = null,
val supportsSessionMessageDiff: Boolean,
Expand All @@ -86,9 +87,9 @@ import kotlinx.serialization.Serializable
val blockID: String,
val toolName: String,
val status: String,
val title: String,
val subtitle: String? = null,
val errorText: String? = null,
val title: @Serializable(with = dev.opencode.mobile.ui.sessionchat.UiTextSerializer::class) dev.opencode.mobile.ui.text.UiText,
val subtitle: @Serializable(with = dev.opencode.mobile.ui.sessionchat.UiTextSerializer::class) dev.opencode.mobile.ui.text.UiText? = null,
val errorText: @Serializable(with = dev.opencode.mobile.ui.sessionchat.UiTextSerializer::class) dev.opencode.mobile.ui.text.UiText? = null,
val additions: Int? = null,
val deletions: Int? = null,
val detailText: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ object CleartextPolicy {
/** mDNS, Tailscale MagicDNS, and the common private-DNS suffixes. */
val trustedNameSuffixes: List<String> = listOf("local", "ts.net", "lan", "internal", "home.arpa")

const val WARNING_TITLE = "Connection isn't encrypted"

fun warningMessage(hosts: List<String>): String {
val subject = if (hosts.isEmpty()) "This address" else hosts.joinToString(", ")
val verb = if (hosts.size > 1) "use" else "uses"
return "$subject $verb plain http outside your local network or Tailscale. " +
"Your server password and everything in your sessions would travel unencrypted. " +
"Prefer https, a VPN, or a tunnel."
}

fun verdict(raw: String): Verdict {
val uri = parse(raw) ?: return Verdict.UntrustedCleartext
val scheme = uri.scheme?.lowercase() ?: "http"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package dev.opencode.mobile.domain.feedback

import dev.opencode.mobile.R
import dev.opencode.mobile.domain.diagnostic.DiagnosticLogExportWindow
import dev.opencode.mobile.ui.text.UiText
import java.util.UUID

/** What the user is reporting. Shown as Bug / Idea; [wireValue] is the report's `kind`. */
Expand Down Expand Up @@ -139,7 +141,7 @@ object FeedbackReference {

/** What the share sheet gets in debug builds, or after Share Instead. */
data class FeedbackSharePayload(
val subject: String,
val subject: UiText,
val text: String,
val attachments: List<FeedbackAttachment>,
) {
Expand All @@ -158,7 +160,13 @@ data class FeedbackSharePayload(
"Ref ${report.reference}",
)
return FeedbackSharePayload(
subject = "OpenCode Mobile ${report.kind.label.lowercase()} report",
subject =
UiText.resource(
when (report.kind) {
FeedbackKind.Bug -> R.string.share_feedback_subject_bug
FeedbackKind.Feedback -> R.string.share_feedback_subject_idea
},
),
text = report.message + "\n\n" + facts.joinToString(" · "),
attachments = report.attachments,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.opencode.mobile.domain.filesystem

import dev.opencode.mobile.ui.text.UiText
import java.net.URLEncoder

/** One File Browser row: a file or folder under the Session Chat worktree. */
Expand Down Expand Up @@ -54,9 +55,16 @@ sealed interface ProjectFileContent {
class ProjectFilesException(
message: String,
/** One-line reason for the user, such as the HTTP status. */
val detail: String,
val detail: UiText,
cause: Throwable? = null,
) : Exception(message, cause)
) : Exception(message, cause) {
/** A detail that is already user-facing text, shown as is. */
constructor(
message: String,
detail: String,
cause: Throwable? = null,
) : this(message, UiText.verbatim(detail), cause)
}

object ProjectFileLimits {
/** Text preview cap; larger files show the first 1 MiB. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package dev.opencode.mobile.domain.filesystem

import dev.opencode.mobile.R
import dev.opencode.mobile.data.remote.FilesystemApi
import dev.opencode.mobile.data.remote.V1FileContentResponse
import dev.opencode.mobile.domain.connection.ServerProtocol
import dev.opencode.mobile.network.ActiveConnectionManager
import dev.opencode.mobile.ui.text.UiText
import io.ktor.client.plugins.ResponseException
import kotlinx.coroutines.CancellationException
import javax.inject.Inject
Expand Down Expand Up @@ -146,10 +148,11 @@ class DefaultProjectFilesRepository
throw ProjectFilesException(failure, detail = describe(error), cause = error)
}

private fun describe(error: Exception): String =
private fun describe(error: Exception): UiText =
when (error) {
is ResponseException -> "The server responded with ${error.response.status.value}."
else -> "Check the connection to the server and try again."
// Not keyed yet: needs a files.* key (#886).
is ResponseException -> UiText.verbatim("The server responded with ${error.response.status.value}.")
else -> UiText.resource(R.string.files_error_check_server_connection)
}

private fun ProjectEntry.withParent(directory: String): ProjectEntry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,25 +285,13 @@ object HomeCompactRowPath {
fun shortBranch(branch: String): String = branch.replace(BRANCH_PREFIX, "").ifEmpty { branch }
}

/** Copy shared by the scope picker, dock, and Run in chooser. */
/**
* Worktree labels from server content, shared by the scope picker, dock, Run in and Move.
* Home shows the keyed "main checkout" (`HomeText`); Session Chat's Move list still uses
* [worktreeSubtitle] until its own localisation slice.
*/
object HomeWorktreeCopy {
const val MAIN_CHECKOUT = "main checkout"
const val RUN_IN = "Run in"
const val OTHER_PROJECTS = "Other projects"
const val SHOW_FEWER = "Show fewer"
const val EDIT = "Edit"
const val DONE = "Done"
const val REORDER_NOTE = "Drag to reorder. Worktrees stay with their project."

fun showAll(count: Int): String = "Show all $count"

fun worktreeCount(count: Int): String = "$count worktrees"

fun allWorktrees(count: Int): String = "All $count worktrees"

fun runningCount(count: Int): String = "$count running"

fun joinedProject(displayName: String): String = "Same repo as $displayName. Showing it as a worktree there."

fun worktreeTitle(worktree: HomeWorktree): String = worktree.branch ?: worktree.folderName

Expand Down Expand Up @@ -349,15 +337,6 @@ data class HomeProjectPickerState(
worktrees.take(COLLAPSED_WORKTREE_LIMIT)
}

/** "Show all N" / "Show fewer" under expanded project [key] with more than the limit; null otherwise. */
fun showAllLabel(
key: String,
worktreeCount: Int,
): String? {
if (worktreeCount <= COLLAPSED_WORKTREE_LIMIT) return null
return if (key in showAllProjectKeys) HomeWorktreeCopy.SHOW_FEWER else HomeWorktreeCopy.showAll(worktreeCount)
}

companion object {
const val COLLAPSED_WORKTREE_LIMIT = 5

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.opencode.mobile.domain.home

import dev.opencode.mobile.R
import dev.opencode.mobile.ui.text.UiText
import java.time.DayOfWeek
import java.time.Instant
import java.time.LocalDate
Expand All @@ -19,15 +21,15 @@ enum class HomeSessionLadderKind {
data class HomeSessionLadderSection<T>(
val id: String,
val kind: HomeSessionLadderKind,
val title: String,
val hint: String? = null,
/** Section header: a keyed label, or a formatted date. */
val title: UiText,
val hint: UiText? = null,
val items: List<T>,
)

object HomeSessionLadder {
val ALLOWED_WINDOW_HOURS: List<Int> = listOf(2, 4, 8, 12, 24)
const val DEFAULT_WINDOW_HOURS: Int = 4
const val RECENT_HINT: String = "Needs a glance"
private const val DAY_WINDOW_COUNT: Int = 7

fun sanitizeWindowHours(hours: Int): Int {
Expand Down Expand Up @@ -74,8 +76,8 @@ object HomeSessionLadder {
HomeSessionLadderSection(
id = "recent",
kind = HomeSessionLadderKind.Recent,
title = "Recent",
hint = RECENT_HINT,
title = UiText.resource(R.string.session_list_section_recent),
Comment thread
ivanfenenko marked this conversation as resolved.
Resolved
hint = UiText.resource(R.string.session_list_section_recent_hint),
items = recent,
)
}
Expand All @@ -100,9 +102,9 @@ object HomeSessionLadder {
if (items.isEmpty()) continue
val title =
when (offset) {
0 -> "Today"
1 -> "Yesterday"
else -> day.format(dayFormatter)
0 -> UiText.resource(R.string.session_list_section_today)
1 -> UiText.resource(R.string.session_list_section_yesterday)
else -> UiText.verbatim(day.format(dayFormatter))
}
sections +=
HomeSessionLadderSection(
Expand Down Expand Up @@ -144,7 +146,11 @@ object HomeSessionLadder {
.forEach { (weekStart, items) ->
val weekEnd = weekStart.plusDays(6)
val title =
"Week of ${weekStart.format(weekFormatter)} – ${weekEnd.format(weekFormatter)}"
UiText.resource(
R.string.session_list_section_week_of,
weekStart.format(weekFormatter),
weekEnd.format(weekFormatter),
)
sections +=
HomeSessionLadderSection(
id = "week-$weekStart",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ package dev.opencode.mobile.domain.session
object OptimisticSessionCreate {
const val PLACEHOLDER_SESSION_ID = "__optimistic_create__"

/**
* Title of the session being created until the server's arrives. Matches the domain's
* untitled-session fallback; both are keyed with Session Chat's localisation (#886).
*/
const val PLACEHOLDER_TITLE = "New Session"

fun isPlaceholder(sessionId: String): Boolean = sessionId == PLACEHOLDER_SESSION_ID
}
Loading