i18n: move folder-label disambiguation patterns into strings.xml #68

Closed
opened 2026-07-01 21:18:17 +00:00 by JMR-dev · 0 comments
JMR-dev commented 2026-07-01 21:18:17 +00:00 (Migrated from github.com)

Origin: code review of PR #54. No user impact until the first translation lands — worth fixing before one does.

Problem

The folder-label disambiguation grammar is hardcoded English concatenation in FolderLabels.kt — "$base - $providerLabel" (line 44), "$base ($it)" (line 45), "$label [$fullName]" (line 54) — making these the only Compose-UI labels assembled in code. The base labels they wrap come from strings.xml, which already expresses this exact pattern as a resource elsewhere (drafts_count = "Drafts (%1$d)"). Translators can't see these strings, and the patterns can't be reordered or re-punctuated for RTL or other locale conventions.

Suggested fix

The seam already exists: FolderDrawer.kt:82-83 resolves localized baseLabels in the composable and passes them into the pure resolver. Do the same for the patterns:

  • Add folder_label_with_provider = "%1$s – %2$s", folder_label_with_parent = "%1$s (%2$s)", folder_label_with_path = "%1$s [%2$s]" to strings.xml.
  • Resolve them at the call site and pass them as parameters into resolveDrawerLabels, formatted inside the resolver.
  • Give the parameters defaults matching today's literals and the existing unit tests pass unchanged; the resolver stays pure and JVM-testable.
Origin: code review of PR #54. No user impact until the first translation lands — worth fixing before one does. ## Problem The folder-label disambiguation grammar is hardcoded English concatenation in `FolderLabels.kt` — `"$base - $providerLabel"` (line 44), `"$base ($it)"` (line 45), `"$label [$fullName]"` (line 54) — making these the only Compose-UI labels assembled in code. The base labels they wrap come from `strings.xml`, which already expresses this exact pattern as a resource elsewhere (`drafts_count = "Drafts (%1$d)"`). Translators can't see these strings, and the patterns can't be reordered or re-punctuated for RTL or other locale conventions. ## Suggested fix The seam already exists: `FolderDrawer.kt:82-83` resolves localized `baseLabels` in the composable and passes them into the pure resolver. Do the same for the patterns: - Add `folder_label_with_provider = "%1$s – %2$s"`, `folder_label_with_parent = "%1$s (%2$s)"`, `folder_label_with_path = "%1$s [%2$s]"` to `strings.xml`. - Resolve them at the call site and pass them as parameters into `resolveDrawerLabels`, formatted inside the resolver. - Give the parameters defaults matching today's literals and the existing unit tests pass unchanged; the resolver stays pure and JVM-testable.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JMR-dev/LibreMail#68