Files
honeyDueKMP/TODO-string-localization.md
Trey t 311a30ed2d Add haptic feedback, rich task completion, and Google Sign-In preparation
- Add platform haptic feedback abstraction (HapticFeedback.kt) with
  implementations for Android, iOS, JVM, JS, and WASM
- Enhance CompleteTaskDialog with interactive 5-star rating, image
  thumbnails, and haptic feedback
- Add ImageBitmap platform abstraction for displaying selected images
- Localize TaskTemplatesBrowserSheet with string resources
- Add Android widgets infrastructure (small, medium, large sizes)
- Add Google Sign-In button components and auth flow preparation
- Update strings.xml with new localization keys for completions,
  templates, and document features
- Integrate haptic feedback into ThemePickerDialog

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 01:06:02 -06:00

4.2 KiB

String Localization Migration TODO

This file tracks the remaining work to migrate hardcoded strings to Compose Resources (composeApp/src/commonMain/composeResources/values/strings.xml).

Completed

High Priority Files (Done)

  • DocumentFormScreen.kt - 48 strings migrated
  • AddTaskDialog.kt - 28 strings migrated

Remaining Work

Priority 1: Dialogs with Many Strings

AddContractorDialog.kt (~25 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/AddContractorDialog.kt

Strings to migrate:

  • Dialog title: "Add Contractor"
  • Field labels: Name *, Company, Phone, Email, Specialty, Notes, Website, Address
  • Validation errors: "Name is required"
  • Buttons: "Create", "Cancel"

CompleteTaskDialog.kt (~22 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/CompleteTaskDialog.kt

Strings to migrate:

  • Dialog title: "Complete Task"
  • Field labels: Notes, Actual Cost, Completion Date
  • Photo section: "Photos", "Camera", "Gallery", "Remove"
  • Buttons: "Complete", "Cancel"
  • Validation messages

Priority 2: Import/Share Dialogs (~14 strings)

ContractorImportDialog.kt (~7 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/ContractorImportDialog.kt

ResidenceImportDialog.kt (~7 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/ResidenceImportDialog.kt

Priority 3: Task Components (~14 strings)

TaskActionButtons.kt (~7 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/task/TaskActionButtons.kt

TaskCard.kt (~7 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/task/TaskCard.kt

Priority 4: Other Dialogs (~10 strings)

JoinResidenceDialog.kt (~7 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/JoinResidenceDialog.kt

ManageUsersDialog.kt (~2 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/ManageUsersDialog.kt

TaskTemplatesBrowserSheet.kt (~3 strings)

Location: composeApp/src/commonMain/kotlin/com/example/casera/ui/components/TaskTemplatesBrowserSheet.kt

Priority 5: Smaller Components (~15 strings total)

Files with 1-3 hardcoded strings each:

  • InfoCard.kt
  • FeatureComparisonDialog.kt
  • ThemePickerDialog.kt
  • StandardCard.kt
  • CompactCard.kt
  • ApiResultHandler.kt
  • DocumentCard.kt
  • DocumentStates.kt
  • CompletionHistorySheet.kt
  • DocumentDetailScreen.kt
  • EditTaskScreen.kt
  • MainScreen.kt
  • UpgradePromptDialog.kt
  • VerifyEmailScreen.kt
  • VerifyResetCodeScreen.kt
  • UpgradeFeatureScreen.kt
  • ResidenceFormScreen.kt

How to Migrate Strings

1. Add import to the file:

import casera.composeapp.generated.resources.*
import org.jetbrains.compose.resources.stringResource

2. Add string to strings.xml:

<string name="component_field_label">Field Label</string>

3. Replace hardcoded string:

// Before
Text("Field Label")

// After
Text(stringResource(Res.string.component_field_label))

4. For strings with parameters:

<string name="items_count">%1$d items</string>
Text(stringResource(Res.string.items_count, count))

5. For strings used in onClick handlers:

Define outside the lambda (stringResource is @Composable):

val errorMessage = stringResource(Res.string.error_message)

Button(onClick = {
    // Use errorMessage here
    showError = errorMessage
})

Naming Convention

Use this pattern for string names:

  • {component}_{field} - e.g., contractor_name_label
  • {component}_{action} - e.g., contractor_create
  • {component}_{error} - e.g., contractor_name_error

Existing prefixes in strings.xml:

  • auth_ - Authentication screens
  • properties_ - Residence/property screens
  • tasks_ - Task screens and components
  • contractors_ - Contractor screens
  • documents_ - Document screens
  • profile_ - Profile screens
  • common_ - Shared strings (Cancel, OK, Back, etc.)

Testing

After migrating strings, run:

./gradlew :composeApp:compileDebugKotlinAndroid

Build should complete successfully with only deprecation warnings.