Skip to content

(feat) Added additional languages for Yazio food search - #2089

Merged
CodeWithCJ merged 5 commits into
mainfrom
dev
Aug 10, 2026
Merged

(feat) Added additional languages for Yazio food search#2089
CodeWithCJ merged 5 commits into
mainfrom
dev

Conversation

@CodeWithCJ

@CodeWithCJ CodeWithCJ commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Tip

Help us review and merge your PR faster!
Please ensure you have completed the Checklist below.
For Frontend changes, please run pnpm run validate to 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

  1. Check out this branch and run ...
  2. Navigate to...
  3. Verify that...

PR Type

  • Issue (bug fix)
  • New Feature
  • Refactor
  • Documentation

Checklist

All PRs:

  • [MANDATORY - ALL] Integrity & License: I certify this is my own work, free of malicious code, and I agree to the License terms.

New features only:

  • [MANDATORY for new feature] Alignment: I have raised a GitHub issue and it was reviewed/approved by maintainers or it was approved on Discord.

Frontend changes (SparkyFitnessFrontend/):

  • [MANDATORY for Frontend changes] Quality: I have run pnpm run validate and it passes.
  • [MANDATORY for Frontend changes] Translations: I have only updated the English (en) translation file.

Backend changes (SparkyFitnessServer/):

  • [MANDATORY for Backend changes] Code Quality: I have run typecheck, lint, and tests. New files use TypeScript, new endpoints have Zod schemas, and new endpoints include tests.
  • [MANDATORY for Backend changes] Database Security: I have updated rls_policies.sql for any new user-specific tables.

UI changes (components, screens, pages):

  • [MANDATORY for UI changes] Screenshots: I have attached Before/After screenshots below.

Mobile changes (SparkyFitnessMobile/):

  • [MANDATORY for Mobile changes] Tested on device or emulator: I have verified the changes work on iOS or Android.

Screenshots

Click to expand

Before

before

After

after

Notes for Reviewers

Optional — use this for anything that doesn't fit above: known tradeoffs, areas you'd like specific feedback on, qustions you have or context that helps reviewers.

Summary by CodeRabbit

  • New Features

    • Expanded YAZIO food search localization to support many additional languages, including Spanish, Russian, Italian, Japanese, Chinese, and Korean.
    • Added localized YAZIO setup labels, credential guidance, required-field validation, and language-support information.
    • Added an informational warning about the unofficial YAZIO API integration.
  • Bug Fixes

    • Improved language fallback behavior when a selected language is unavailable.

“CodewithCJ” added 4 commits August 10, 2026 16:56
…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
@github-actions github-actions Bot added backend enhancement New feature or request frontend labels Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Validation Results

Change Detection

  • 🖥️ Frontend changes detected
  • ⚙️ Backend changes detected
  • 🌐 en translation file modified

✅ All checks passed. Thank you!

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 464e3370-cf7a-4327-8f67-b24290238dd2

📥 Commits

Reviewing files that changed from the base of the PR and between 82418dd and 2e5f194.

📒 Files selected for processing (1)
  • SparkyFitnessFrontend/src/pages/Settings/ProviderSpecificFields.tsx

📝 Walkthrough

Walkthrough

YAZIO 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.

Changes

YAZIO localization

Layer / File(s) Summary
Expand YAZIO locale resolution
SparkyFitnessServer/integrations/yazio/yazioService.ts
YAZIO adds country and locale mappings for additional languages. SUPPORTED_LANGUAGES now derives from YAZIO_LOCALES.
Localize YAZIO provider settings
SparkyFitnessFrontend/public/locales/en/translation.json, SparkyFitnessFrontend/src/pages/Settings/ProviderSpecificFields.tsx
YAZIO labels, placeholders, validation text, API guidance, and language-support guidance use translation keys with English fallbacks.
Validate localized search parameters
SparkyFitnessServer/tests/yazioService.test.ts
Tests verify Russian and Spanish query parameters and fallback behavior for unsupported languages.

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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description leaves the problem, implementation, testing steps, and screenshots as template placeholders. Replace the placeholders with the actual problem, implementation, test commands, verification steps, and relevant screenshots.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: adding additional language support for YAZIO food searches.
Linked Issues check ✅ Passed The changes add Russian locale support, dynamic locale configuration, and fallback tests required by issue [#2075].
Out of Scope Changes check ✅ Passed The frontend, backend, localization, and test changes remain focused on YAZIO language and locale support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
SparkyFitnessFrontend/public/locales/en/translation.json (1)

1122-1122: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4eec296 and 82418dd.

📒 Files selected for processing (4)
  • SparkyFitnessFrontend/public/locales/en/translation.json
  • SparkyFitnessFrontend/src/pages/Settings/ProviderSpecificFields.tsx
  • SparkyFitnessServer/integrations/yazio/yazioService.ts
  • SparkyFitnessServer/tests/yazioService.test.ts

Comment thread SparkyFitnessFrontend/public/locales/en/translation.json
@CodeWithCJ
CodeWithCJ merged commit 01bbc1e into main Aug 10, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add Russian language / Russia locale support to YAZIO food provider

1 participant