feat(mobile): add Polish localization and native language support - #2054
feat(mobile): add Polish localization and native language support#2054Dragonk wants to merge 70 commits into
Conversation
Add mobile i18n support, automatic device language detection, and manual language selection. Refs CodeWithCJ#1774 Refs CodeWithCJ#1490
Add data layer and UI for custom (user-defined) measurements. Stage 7 — Data layer: - Types for CustomCategory and CustomMeasurementEntry - API client functions (fetchCustomCategories, fetchCustomMeasurementsByDate, save, delete) - TanStack Query hooks with automatic cache invalidation - Query keys and barrel exports Stage 8 — UI integration: - MeasurementsAddScreen: dynamic custom measurement fields rendered per category, with numeric/text/boolean input, prefilled existing values, clear-on-empty, and save/delete - MeasurementsSummary: tiles for custom entries alongside built-in measurements - DiaryScreen: hasAnyMeasurement includes custom entries
- Convert async i18n tests to jest.isolateModulesAsync - Block built-in saves when custom form fails validation - Add confirmation Alert for custom deletes with affected category names - Gate save button on custom-data loading/error state - Add dynamic-content protection tests (MeasurementsSummary, FoodLibraryRow, MealLibraryRow, ExerciseHistoryList, MeasurementsAddScreen t-spy)
This reverts commit 0e95c0b.
…nguage-settings # Conflicts: # SparkyFitnessMobile/App.tsx # SparkyFitnessMobile/__tests__/screens/MeasurementsAddScreen.test.tsx # SparkyFitnessMobile/src/components/ActionSheet.tsx # SparkyFitnessMobile/src/components/AddSheet.tsx # SparkyFitnessMobile/src/components/BottomSheetPicker.tsx # SparkyFitnessMobile/src/components/ConnectionStatus.tsx # SparkyFitnessMobile/src/components/CopyMealSheet.tsx # SparkyFitnessMobile/src/components/DateRangeSheet.tsx # SparkyFitnessMobile/src/components/DevTools.tsx # SparkyFitnessMobile/src/components/EndFastSheet.tsx # SparkyFitnessMobile/src/components/FastingEditSheet.tsx # SparkyFitnessMobile/src/components/FastingHistorySheet.tsx # SparkyFitnessMobile/src/components/FoodForm.tsx # SparkyFitnessMobile/src/components/HydrationGauge.tsx # SparkyFitnessMobile/src/components/MacroSummaryCard.tsx # SparkyFitnessMobile/src/components/NutrientBarChart.tsx # SparkyFitnessMobile/src/components/RestPeriodSheet.tsx # SparkyFitnessMobile/src/components/ServingAdjustSheet.tsx # SparkyFitnessMobile/src/components/StepsBarChart.tsx # SparkyFitnessMobile/src/components/SwipeableDeleteRow.tsx # SparkyFitnessMobile/src/components/SwipeableExerciseRow.tsx # SparkyFitnessMobile/src/components/SwipeableFoodRow.tsx # SparkyFitnessMobile/src/components/SwipeableIngredientRow.tsx # SparkyFitnessMobile/src/components/SyncFrequency.tsx # SparkyFitnessMobile/src/components/SyncOnOpen.tsx # SparkyFitnessMobile/src/components/WeightLineChart.tsx # SparkyFitnessMobile/src/components/medications/WeekdaySheet.tsx # SparkyFitnessMobile/src/components/wellness/BBTLineChart.tsx # SparkyFitnessMobile/src/screens/ActivityAddScreen.tsx # SparkyFitnessMobile/src/screens/ActivityDetailScreen.tsx # SparkyFitnessMobile/src/screens/AppSettingsScreen.tsx # SparkyFitnessMobile/src/screens/CalorieSettingsScreen.tsx # SparkyFitnessMobile/src/screens/CycleHubScreen.tsx # SparkyFitnessMobile/src/screens/CycleLogModalScreen.tsx # SparkyFitnessMobile/src/screens/CycleOnboardingScreen.tsx # SparkyFitnessMobile/src/screens/CycleSettingsScreen.tsx # SparkyFitnessMobile/src/screens/DailyNutritionDetailsScreen.tsx # SparkyFitnessMobile/src/screens/DashboardScreen.tsx # SparkyFitnessMobile/src/screens/DashboardSettingsScreen.tsx # SparkyFitnessMobile/src/screens/DiaryScreen.tsx # SparkyFitnessMobile/src/screens/DiarySettingsScreen.tsx # SparkyFitnessMobile/src/screens/ExercisesLibraryScreen.tsx # SparkyFitnessMobile/src/screens/FastingDetailScreen.tsx # SparkyFitnessMobile/src/screens/FoodEntryAddScreen.tsx # SparkyFitnessMobile/src/screens/FoodFormScreen.tsx # SparkyFitnessMobile/src/screens/FoodPhotoLogEntryScreen.tsx # SparkyFitnessMobile/src/screens/FoodSearchScreen.tsx # SparkyFitnessMobile/src/screens/FoodsLibraryScreen.tsx # SparkyFitnessMobile/src/screens/MealAddScreen.tsx # SparkyFitnessMobile/src/screens/MealTypeDetailScreen.tsx # SparkyFitnessMobile/src/screens/MealsLibraryScreen.tsx # SparkyFitnessMobile/src/screens/MeasurementsAddScreen.tsx # SparkyFitnessMobile/src/screens/MedicationFormScreen.tsx # SparkyFitnessMobile/src/screens/MedicationScheduleFormScreen.tsx # SparkyFitnessMobile/src/screens/NotificationSettingsScreen.tsx # SparkyFitnessMobile/src/screens/NutrientTrendsScreen.tsx # SparkyFitnessMobile/src/screens/SyncScreen.tsx # SparkyFitnessMobile/src/screens/WorkoutAddScreen.tsx # SparkyFitnessMobile/src/screens/WorkoutPresetsLibraryScreen.tsx # SparkyFitnessMobile/src/screens/WorkoutSettingsScreen.tsx # SparkyFitnessMobile/src/utils/dateUtils.ts
Assisted-by: Open WebUI
Assisted-by: Open WebUI
Assisted-by: Open WebUI
Assisted-by: Open WebUI
Localize the new exercise image crossfade accessibility labels introduced by upstream PR CodeWithCJ#2047. Assisted-by: Open WebUI
Localize ownership filter UI, remove duplicated favorite stars, drop removed popover DevTools tests, and localize the new exercise image crossfade accessibility labels. Assisted-by: Open WebUI
Assisted-by: Open WebUI
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Wow that's a lot, thanks again for taking this on. I know this is a draft but would you be able to split this up into a sequence of PRs? 30k lines added and most of them are replacing strings with t() is going to be very hard to review. Something like:
I know splitting after the fact is a pain. If you want help pulling it apart or have other concerns let me know |
That makes sense. I’ll first finish building the app with everything together so I can do a full round of device testing on the integrated version. After that I’ll try to split this draft into a sequence of smaller PRs so each part is easier to review:
I’ll keep the current branch as the integrated reference while I split the work out. That should also make it easier to verify that the smaller PRs still behave the same as the fully integrated build. Thanks for the suggestion — I agree this should make the review much more manageable. |
|
Always include english wording as fallback. This way even if the translation files are not available, the app will continue to work. Also, Translation files are maintained in another repository. Are we not re-using the existing translation @apedley any suggestion on this? I know there were some discussion earlier around this. |
PR Validation ResultsChange Detection
|
Android device testing — completed ✅Verified on a real Android device against a current-
Known follow-ups (not blocking this draft): a few isolated UI strings still render in English (e.g. "Save", "End workout") — individual cases to resolve in follow-up PRs after architecture approval. iOS Xcode/device validation remains pending. |
You'll have to copy the translation files to the translations repo (mobile/en/translation.json and one for pl), create a component in weblate, then update sync-translations.yml for github action to handle mobile paths. By creating the weblate component in the same project, we get shared translation memory. So strings like "save" or "cancel" that were already translated for web will affect mobile. Since the translation is bundled for mobile I wouldn't do anything until we are close to merging the final step. Otherwise youll have to copy the files again |
Tip
Draft — automated QA and Android device testing are complete; iOS native validation is still in progress. A few isolated untranslated strings (e.g. "Save", "End workout") are known and will be addressed in follow-up PRs after architecture approval.
Description
What problem does this PR solve?
Adds full Polish (PL) localization and native language support to the mobile app, alongside mobile compatibility fixes for custom measurement entries and custom meal types in the Diary. The branch is synchronized with the current upstream
main.How did you implement the solution?
t()).main(food search / ownership filters, workout telemetry, exercise images) without regressing the i18n work.How to Test
pnpm install --frozen-lockfilein the repo root.pnpm run typecheck && pnpm run lint && pnpm run i18n:auditinSparkyFitnessMobile/.npx expo prebuild --clean --platform android, thengradlew assembleRelease).0,false, PL decimal1,5, Daily/Hourly/Unlimited, delete), workout, and widgets in both languages.PR Type
Checklist
All PRs:
New features only:
Frontend changes (
SparkyFitnessFrontend/):pnpm run validateand it passes.en) translation file.Backend changes (
SparkyFitnessServer/):rls_policies.sqlfor any new user-specific tables.UI changes (components, screens, pages):
Mobile changes (
SparkyFitnessMobile/):Testing status (verified)
mainserver. App starts, no translation keys are shown, language switching works (System / English / Polski), Diary (system + custom meal types), custom measurements, workouts, and widgets all work correctly.Known follow-ups (not blocking this draft)
Related issues
Resolved by this implementation
Related / partially addressed
Screenshots
Click to expand
Before
After
Screenshots will be added after final manual validation.
Notes for Reviewers