Skip to content

Replace language chooser with EthnoLib implementation#1481

Draft
chrisvire wants to merge 2 commits intodevelopfrom
feature/language-chooser
Draft

Replace language chooser with EthnoLib implementation#1481
chrisvire wants to merge 2 commits intodevelopfrom
feature/language-chooser

Conversation

@chrisvire
Copy link
Member

@chrisvire chrisvire commented Mar 15, 2026

Summary by CodeRabbit

  • New Features

    • Language selection in project creation now uses a modal dialog instead of a typeahead input.
  • Chores

    • Added language selection component dependency.
    • Updated Vite configuration to optimize dependency bundling.

@chrisvire chrisvire marked this pull request as draft March 15, 2026 03:21
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 15, 2026

📝 Walkthrough

Walkthrough

The changes integrate a new modal-based language selection component (@ethnolib/language-chooser-svelte-daisyui) as a replacement for the existing LanguageCodeTypeahead. The new component is added as a development dependency, imported into the project creation form, and Vite's dependency optimization is configured to exclude ethnolib packages from pre-bundling.

Changes

Cohort / File(s) Summary
Dependency Management
package.json, vite.config.ts
Added @ethnolib/language-chooser-svelte-daisyui as a dev dependency and configured Vite to exclude ethnolib packages from pre-bundling optimization.
Component Integration
src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte
Replaced LanguageCodeTypeahead with LanguageChooserModal; removed inline validation logic (langtagRegex, regExpToInputPattern); added showLanguageModal state and button-triggered modal workflow; maintains form.Language binding.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Fix Reviewer form issue #1469: Related changes to how the form's hidden language field is handled in conjunction with language selection components.

Suggested reviewers

  • 7dev7urandom

Poem

🐰 A modal blooms where typeahead once dwelled,
Language selection now chimed and swelled,
Ethnolib magic, bundled with care,
Vite excludes what needn't share,
The chooser hops in with Daisyui flair! 🌼

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing the existing language chooser component with a new EthnoLib-based implementation across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/language-chooser
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
vite.config.ts (1)

7-14: Consider adding a comment explaining why these packages are excluded.

The optimizeDeps.exclude configuration is appropriate for Svelte component libraries that may not work well with Vite's esbuild-based pre-bundling. A brief comment would help future maintainers understand why these specific packages need special handling.

📝 Suggested documentation
 export default defineConfig({
+  // Exclude `@ethnolib` packages from pre-bundling as they are Svelte component libraries
+  // that need to be processed by the Svelte compiler rather than esbuild
   optimizeDeps: {
     exclude: [
       '@ethnolib/language-chooser-svelte-daisyui',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@vite.config.ts` around lines 7 - 14, Add a brief explanatory comment above
the optimizeDeps.exclude configuration that states why these packages are being
excluded (e.g., they are Svelte component/controller/state libraries that break
Vite's esbuild pre-bundling or require special handling), and mention the
specific packages listed ('@ethnolib/language-chooser-svelte-daisyui',
'@ethnolib/language-chooser-controller', '@ethnolib/find-language',
'@ethnolib/state-management-svelte') so future maintainers understand the
rationale for optimizeDeps.exclude.
src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte (1)

86-92: Button lacks visual affordance for required field.

The button shows the placeholder text m.project_languageCode() when empty, but there's no required attribute or visual indicator that language selection is mandatory. The submit button is disabled until $form.Language.length is truthy (line 140), but users may not understand why they can't submit.

Consider adding a visual cue similar to the Name field's required: true treatment.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routes/`(authenticated)/projects/new/[id=idNumber]/+page.svelte around
lines 86 - 92, The language-picker button (onclick={() =>
showLanguageModal?.()}, displaying {$form.Language || m.project_languageCode()})
lacks a required-field affordance even though form submission is gated by
$form.Language.length; update the button to surface that it is required by
adding an accessible and visual cue: set aria-required="true" and add the same
required visual treatment/class used by the Name field (e.g., the required:true
styling or an explicit "required" CSS class and an asterisk in the label text),
and ensure any client-side validation still checks $form.Language before
enabling the submit button so behavior matches the new UI affordance.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/routes/`(authenticated)/projects/new/[id=idNumber]/+page.svelte:
- Around line 86-92: The language-picker button (onclick={() =>
showLanguageModal?.()}, displaying {$form.Language || m.project_languageCode()})
lacks a required-field affordance even though form submission is gated by
$form.Language.length; update the button to surface that it is required by
adding an accessible and visual cue: set aria-required="true" and add the same
required visual treatment/class used by the Name field (e.g., the required:true
styling or an explicit "required" CSS class and an asterisk in the label text),
and ensure any client-side validation still checks $form.Language before
enabling the submit button so behavior matches the new UI affordance.

In `@vite.config.ts`:
- Around line 7-14: Add a brief explanatory comment above the
optimizeDeps.exclude configuration that states why these packages are being
excluded (e.g., they are Svelte component/controller/state libraries that break
Vite's esbuild pre-bundling or require special handling), and mention the
specific packages listed ('@ethnolib/language-chooser-svelte-daisyui',
'@ethnolib/language-chooser-controller', '@ethnolib/find-language',
'@ethnolib/state-management-svelte') so future maintainers understand the
rationale for optimizeDeps.exclude.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5269a2ce-7adc-4a41-a981-9b60693eeb25

📥 Commits

Reviewing files that changed from the base of the PR and between 38f8c67 and e0165ca.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • package.json
  • src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte
  • vite.config.ts

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.

1 participant