Far-Beyond-Pulsar/Pulsar-Native

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

已關閉

#478 建立於 2026年7月29日

 (0 則留言) (0 個反應) (0 位負責人)Rust (29 個分叉)auto 404
bugdifficulty: easyenhancementgood first issuehelp wantedpriority: high

倉庫指標

星標
 (348 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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)

貢獻者指南