Skip to content

Improve language handling#107

Merged
imol-ai merged 6 commits into
mainfrom
improve-languages
Jun 19, 2026
Merged

Improve language handling#107
imol-ai merged 6 commits into
mainfrom
improve-languages

Conversation

@jschoedl

@jschoedl jschoedl commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Adds optional language enum to RecipeRequest so generated recipes match the active UI language.

  • Add an 'Auto' option in the language preferences
  • change language picker to a native dropdown on mobile
  • Web client sends current UI language with each recipe request
  • Spring API forwards client UI language to GenAI service by wiring it into the profile

🤖 Generated with Claude Code

- Add optional `language` enum (EN/DE/HU) to RecipeRequest spec
- Spring API forwards client UI language to GenAI service
- All clients regenerated: TS api.ts, Kotlin RecipeRequest, Python clients
- Web client sends active UI language with each recipe request
- Add i18n test suite and update GeneratePage/ProfilePage tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jschoedl jschoedl changed the title Regenerate clients for RecipeRequest language field Improve language handling Jun 18, 2026
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

🧹 The preview environment was removed because this PR was closed.

The inline enums generated two incompatible Language types, breaking the
controller that copies the request language into profile preferences.
$ref a shared Language schema so codegen emits one enum everywhere.

Also fix the German-locale ProfilePage test to click "Automatisch".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jschoedl and others added 2 commits June 18, 2026 15:41
# Conflicts:
#	services/spring-api/src/main/kotlin/org/openapitools/api/AIApiController.kt
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jschoedl

Copy link
Copy Markdown
Collaborator Author

Can you please review if the language picker looks fine on your phones? Especially @paulwiese on iOS

The recipe controller serializes the GenAI request body to a JSON string
via objectMapper.writeValueAsString, so the test helper must deserialize
it rather than casting the captured value to a Map.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@paulwiese

Copy link
Copy Markdown
Collaborator

Can you please review if the language picker looks fine on your phones? Especially @paulwiese on iOS

Looks good!

const tagLabels = selectedTags.map((id) => tagsById.get(id)?.label).filter(Boolean)
const fullPrompt = tagLabels.length > 0 ? `${prompt}\n\nPreferences: ${tagLabels.join(', ')}` : prompt
const body: RecipeRequest = {prompt: fullPrompt}
const body: RecipeRequest = {prompt: fullPrompt, language: currentLanguage()}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do I understand it correctly that the language is detected based on Browser settings etc. ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it's

  1. Language set in the preferences
  2. If Auto: language of the browser
  3. If not supported: English

(So now the same for GenAI as it is for the UI)

@paulwiese paulwiese left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

Resolve conflicts:
- AIApiController: keep main's Retrofit-based internal client, fold in the
  language-override feature (RecipeRequest.language overrides the forwarded
  profile's preference).
- AIApiTest: rewrite the language test against the Retrofit mock, capturing
  the forwarded RecipeRequestForwarded.
- Regenerate the Python internal clients from the resolved openapi-internal
  spec (package renamed to cooking_assistant_gen_ai_services_api_internal_client).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@imol-ai imol-ai merged commit 31a6c8b into main Jun 19, 2026
14 checks passed
@imol-ai imol-ai deleted the improve-languages branch June 19, 2026 11:18
github-actions Bot added a commit that referenced this pull request Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants