Skip to content

Add i18n support to Svelte language chooser using typesafe-i18n#6

Draft
Copilot wants to merge 5 commits intoui-controllerfrom
copilot/add-translations-svelte-app
Draft

Add i18n support to Svelte language chooser using typesafe-i18n#6
Copilot wants to merge 5 commits intoui-controllerfrom
copilot/add-translations-svelte-app

Conversation

Copy link

Copilot AI commented Nov 1, 2025

The language-chooser-svelte-daisyui app lacked internationalization support. This adds translations for English, Spanish, and French using typesafe-i18n, matching the locales available in the React app.

Changes

  • Added typesafe-i18n (5.26.2) with Svelte adapter configuration
  • Translation dictionaries for en, es, fr in src/i18n/ with all UI strings
  • Locale initialization in main.ts with browser language detection via navigatorDetector
  • Language switcher dropdown in App.svelte header
  • Component updates to use $LL translation store in App.svelte, LanguageChooser.svelte, CustomizationModal.svelte

Usage

<script lang="ts">
  import LL from "./i18n/i18n-svelte";
  import { setLocale } from "./i18n/i18n-svelte";
</script>

<h1>{$LL.app.title()}</h1>
<button onclick={() => setLocale("es")}>Español</button>

The locale is reactive - changing it updates all translated strings across components.

Screenshots

English
English

Spanish
Spanish

French
French

Modal (French)
Modal

Original prompt

This section details on the original issue you should resolve

<issue_title>Add translations to Svelte app</issue_title>
<issue_description>On the ui-controller branch, the language-chooser-svelte-daisyui app needs to support multiple languages.

Use the typesafe-i18n package to support multiple interface languages for the Svelte app.

The Svelte app should use the same locales that language-chooser-react-mui does. These locales are located under the locales folder. Currently, we support English, Spanish (es-419), and some French. The Svelte app should support each of these languages.

To demonstrate that the translations are working, add a dropdown in App.svelte that changes the interface language.

The target branch for these changes is ui-controller.</issue_description>

<agent_instructions>To run the Svelte app, use nx dev @ethnolib/language-chooser-svelte-daisyui from the command line.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits November 1, 2025 17:04
Co-authored-by: gmjgeek <76575908+gmjgeek@users.noreply.github.com>
Co-authored-by: gmjgeek <76575908+gmjgeek@users.noreply.github.com>
Co-authored-by: gmjgeek <76575908+gmjgeek@users.noreply.github.com>
Co-authored-by: gmjgeek <76575908+gmjgeek@users.noreply.github.com>
Copilot AI changed the title [WIP] Add translations support to Svelte app Add i18n support to Svelte language chooser using typesafe-i18n Nov 1, 2025
Copilot AI requested a review from gmjgeek November 1, 2025 17:20
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.

2 participants