# 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) - [x] `DocumentFormScreen.kt` - 48 strings migrated - [x] `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: ```kotlin import casera.composeapp.generated.resources.* import org.jetbrains.compose.resources.stringResource ``` ### 2. Add string to strings.xml: ```xml Field Label ``` ### 3. Replace hardcoded string: ```kotlin // Before Text("Field Label") // After Text(stringResource(Res.string.component_field_label)) ``` ### 4. For strings with parameters: ```xml %1$d items ``` ```kotlin Text(stringResource(Res.string.items_count, count)) ``` ### 5. For strings used in onClick handlers: Define outside the lambda (stringResource is @Composable): ```kotlin 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: ```bash ./gradlew :composeApp:compileDebugKotlinAndroid ``` Build should complete successfully with only deprecation warnings.