(feat) Added additional languages for Yazio food search - #2089
Conversation
…rovider
Adds Russian (`ru`) language and locale support to the YAZIO food provider integration so Russian search queries target appropriate Russian food database markets (`countries=RU` and `locales=ru_RU`) rather than falling back to default German/US/French locales.
- Added `{ countries: ['RU'], locales: ['ru_RU'] }` to `YAZIO_LOCALES` in `SparkyFitnessServer/integrations/yazio/yazioService.ts`.
- Refactored `SUPPORTED_LANGUAGES` to dynamically derive from `Object.keys(YAZIO_LOCALES)`.
- Added unit tests in `SparkyFitnessServer/tests/yazioService.test.ts` to verify Russian search query parameters and fallback behavior for unsupported languages.
Closes #2075
…rovider
Adds Russian (`ru`) language and locale support to the YAZIO food provider integration so Russian search queries target appropriate Russian food database markets (`countries=RU` and `locales=ru_RU`) rather than falling back to default German/US/French locales.
- Added `{ countries: ['RU'], locales: ['ru_RU'] }` to `YAZIO_LOCALES` in `SparkyFitnessServer/integrations/yazio/yazioService.ts`.
- Refactored `SUPPORTED_LANGUAGES` to dynamically derive from `Object.keys(YAZIO_LOCALES)`.
- Added unit tests in `SparkyFitnessServer/tests/yazioService.test.ts` to verify Russian search query parameters and fallback behavior for unsupported languages.
Closes #2075
PR Validation ResultsChange Detection
✅ All checks passed. Thank you! |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughYAZIO now supports additional language and country locale mappings. The provider settings use translated YAZIO labels and guidance. Tests verify Russian, Spanish, and unsupported-language search behavior. ChangesYAZIO localization
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Settings
participant yazioService
participant YAZIO_API
Settings->>yazioService: configured language and search query
yazioService->>yazioService: resolve YAZIO_LOCALES
yazioService->>YAZIO_API: send country and locale parameters
YAZIO_API-->>yazioService: localized search results
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
SparkyFitnessFrontend/public/locales/en/translation.json (1)
1122-1122: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the YAZIO language-support message synchronized with locale configuration.
The supported-language list is manually duplicated in two files. A locale change can make either message inaccurate.
SparkyFitnessFrontend/public/locales/en/translation.json#L1122-L1122: Replace the hardcoded list or generate it from shared locale data.SparkyFitnessFrontend/src/pages/Settings/ProviderSpecificFields.tsx#L350-L355: Apply the same generated list or use a generic fallback sentence.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@SparkyFitnessFrontend/public/locales/en/translation.json` at line 1122, Synchronize the YAZIO language-support message with the shared locale configuration instead of maintaining a duplicated hardcoded list. Update SparkyFitnessFrontend/public/locales/en/translation.json:1122-1122 and the related YAZIO message in SparkyFitnessFrontend/src/pages/Settings/ProviderSpecificFields.tsx:350-355 to use the same generated supported-language data, or use a generic fallback sentence in both locations so future locale changes cannot make either message inaccurate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@SparkyFitnessFrontend/public/locales/en/translation.json`:
- Around line 1110-1112: Update the YAZIO warning block in
ProviderSpecificFields to use useTranslation() and the new unofficialApiTitle,
unofficialApiWarning, and moreInfoLink keys instead of English literals. Use
Trans where emphasized phrases or embedded links require placeholders,
preserving the existing formatting and link behavior.
---
Nitpick comments:
In `@SparkyFitnessFrontend/public/locales/en/translation.json`:
- Line 1122: Synchronize the YAZIO language-support message with the shared
locale configuration instead of maintaining a duplicated hardcoded list. Update
SparkyFitnessFrontend/public/locales/en/translation.json:1122-1122 and the
related YAZIO message in
SparkyFitnessFrontend/src/pages/Settings/ProviderSpecificFields.tsx:350-355 to
use the same generated supported-language data, or use a generic fallback
sentence in both locations so future locale changes cannot make either message
inaccurate.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 903275f0-eab9-4971-9e49-09fced57fe8c
📒 Files selected for processing (4)
SparkyFitnessFrontend/public/locales/en/translation.jsonSparkyFitnessFrontend/src/pages/Settings/ProviderSpecificFields.tsxSparkyFitnessServer/integrations/yazio/yazioService.tsSparkyFitnessServer/tests/yazioService.test.ts
Tip
Help us review and merge your PR faster!
Please ensure you have completed the Checklist below.
For Frontend changes, please run
pnpm run validateto check for any errors.PRs that include tests and clear screenshots are highly preferred!
Note: AI-generated descriptions must be manually edited for conciseness. Do not paste raw AI summaries.
Description
What problem does this PR solve?
(Keep it concise. 1–2 sentences.)
How did you implement the solution?
(Brief technical approach.)
Linked Issue: Closes #2075
How to Test
...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/):Screenshots
Click to expand
Before
After
Notes for Reviewers
Summary by CodeRabbit
New Features
Bug Fixes