Skip to content

[good first issue] Detect system locale on first launch (default to English for non-zh systems) #26

Description

@GoDiao

Summary

DreamCoder defaults to Chinese UI on first launch. Users on non-Chinese systems must navigate Settings — itself in Chinese — to switch to English. This is a textbook onboarding cliff for international users.

Real-world report

"When the app opens it should ask which lang user prefer cause it was all chinese and i dont know chinese so changing lang after finding it in settings is an another hustle."
@Kafkacodes, #8 (comment)

This is the first feedback we have from an English-speaking contributor, and it's the very first thing they hit before they could do anything else. That's the strongest possible signal.

Why this matters

  • We're actively recruiting international contributors (good first issues in English, README_en.md, CONTRIBUTING_en.md, English Discussions).
  • Recruiting English-speaking contributors and then handing them a Chinese-only first-run UI wastes the funnel.
  • Locale data is already in the app — we just don't ask the OS.

Proposed UX

Option A — System locale auto-detection (recommended for v1)

On first launch, when no language preference is persisted yet:

  1. Read OS locale (navigator.language in WebView, or tauri::api::os::locale() on the Rust side).
  2. If locale starts with zh → Chinese.
  3. Otherwise → English.
  4. Persist the choice on first user interaction.

Trade-off: silent. Users never see "we picked X for you" — they just get a coherent first experience.

Option B — First-run language picker

Show a tiny modal on the very first launch:

┌─────────────────────────────┐
│  Welcome to DreamCoder      │
│                             │
│  Language / 语言            │
│   ◯ English                 │
│   ◯ 简体中文                │
│                             │
│         [ Continue ]        │
└─────────────────────────────┘

Trade-off: more work, but explicit signal that we care about both audiences.

Recommendation

Ship Option A as the v0.4.x patch (small, safe, instantly fixes @Kafkacodes' complaint). Layer Option B on top later when a proper "first-run welcome" lands.

Files likely to touch

  • desktop/src/i18n/index.ts (or wherever i18n bootstrap lives)
  • desktop/src/store/settingsStore.ts (where language preference is persisted)
  • Possibly src-tauri/src/lib.rs if we want OS-level locale detection via Tauri command

Acceptance

  • On a system with non-zh locale, first launch defaults to English.
  • On a system with zh-* locale, first launch defaults to Chinese (preserves existing behaviour for current users).
  • User's manual language switch persists and overrides auto-detection on subsequent launches.
  • Brief note in README explaining the behaviour.

Difficulty

⭐⭐ — half a day, mostly i18n bootstrap.

Credit

Reported by @Kafkacodes in #8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions