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)

贡献者指南