Far-Beyond-Pulsar/Pulsar-Native

wgpui-component (ui) crate has rust_i18n initialized but no locale files

Open

#478 opened on Jul 29, 2026

 (0 comments) (0 reactions) (0 assignees)Rust (29 forks)auto 404
bugdifficulty: easyenhancementgood first issuehelp wantedpriority: high

Repository metrics

Stars
 (348 stars)
PR merge metrics
 (PR metrics pending)

Description

Summary

The crates/ui/wgpui-component/crates/ui/src/lib.rs:179 crate calls rust_i18n::i18n!("locales", fallback = "en") but no locales/ directory exists anywhere under crates/ui/wgpui-component/crates/ui/. This means every t!() call within this crate resolves to raw key names instead of translated text.

Impact

All t!() usages across the shared UI component library show untranslated keys to users:

Key Used in File
Dropdown.placeholder dropdown.rs, dropdown/base.rs Multiple places
Modal.ok / Modal.cancel modal.rs Lines 299, 329
Dock.* (Unnamed, Close, Zoom, Collapse, Expand) dock/panel.rs, dock/tab_panel/render.rs Multiple
Calendar.* time/calendar.rs All month/week labels
DatePicker.* time/date_picker.rs Placeholder
Input.* (Replace, Replace All, Cut, Copy, Paste, Select All) input/search.rs Lines 548, 557
List.search_placeholder list/list.rs Search placeholder

Additionally, window_wrapper.rs:27 uses crate::translate() with keys like "Window.Title.FileManager" that are only defined in ui_common/locales/en.yml — a different crate's locale scope. These will also fail to resolve.

Reproduction

Try switching the editor to any non-English locale — all shared UI components (dock panels, dropdowns, modals, calendars, search bars) will display raw key names instead of translations.

Suggested fix

  1. Create locales/ directory in crates/ui/wgpui-component/crates/ui/
  2. Add en.yml containing all keys used by t!() calls in this crate (can extract from ui_common/locales/en.yml for the shared keys, plus crate-specific keys)
  3. Either copy the keys to each locale file that ui_common supports, or establish a shared locale mechanism

See also: #58 (tabs and panel titles — partially overlaps)

Contributor guide