Far-Beyond-Pulsar/Pulsar-Native

~100 hardcoded user-facing strings in wgpui-component UI components

已關閉

#481 建立於 2026年7月29日

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

倉庫指標

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

描述

Summary

The shared UI component crate (crates/ui/wgpui-component/crates/ui/src/) contains ~100+ hardcoded English strings that use format!(...) directly instead of going through t!(). These strings are user-facing and should be translatable.

Files and strings

profiler.rs (~70 strings) — the largest concentration:

  • Counter tile labels: "FPS", "Mean Frame", "Max Frame", "Present Mode", "Frames Captured", "Full-draw Frames", "Fast-path Frames", "Atlas Hit Rate"
  • Flame lane labels: "Main Thread (CPU)", "GPU", format!("Background Thread {}", index + 1)
  • Section headings: "Draw Calls & Primitives", "CPU/GPU Submit Timeline", "CPU Memory", "GPU Memory", "Live Preview", "Node Details"
  • Draw call table: "Quads", "Shadows", "Mono Sprites", "Poly Sprites", "Paths", "Underlines", "Backdrop Filters", "Surfaces"
  • Button labels: "Start Capture" / "Stop Capture", "Capture Frame", "Refresh Snapshot", "Capture UI Tree"
  • DescriptionList labels: "Duration", "Depth", "Lane", "Category", "Element", "Source", "Type", "Display", "Visibility", "Background", "Text Color", etc.
  • Memory section: "Element Arena", "Glyph Cache", "Shaped Line Cache", "Image Cache", "Capture Engine"
  • GPU memory: "Fixed Buffers", "Atlas Textures", "Surface Registry", "Swapchain"

inspector.rs (~20 strings):

  • "Inspector", "Rust Styles", "JSON Styles", "Box Model", "Reset"
  • Layout labels: "Width", "Height", "X", "Y", "Margin", "Border", "Padding", "Content"
  • Empty states: "No elements available.", "Select an element to view its styles.", etc.

download_item.rs: "Downloading", "Done", "Error", "Complete", "Open Folder", format!("ETA {}", eta)

download_manager.rs: format!("Downloads — {} active", ...), "No downloads yet", "Downloads"

code_editor.rs: format!("Ln {line}, Col {col}"), format!("{total_lines} lines"), "UTF-8"

color_picker/picker.rs: Channel labels "R", "G", "B", "A", harmony names "Complementary", "Analogous", "Triadic", section headings "All Colors", "Color Relations", "Recent", "Code", format!("Palette: {}")

hierarchical_list_view.rs: format!("{} objects", ...)

replication.rs: format!("Locked by {}", ...), format!("+{}", ...)

Suggested fix

For each string, replace with t!("Key.Name") and add the key to the crate's locales/en.yml (which currently does not exist — see #478). For format!() with dynamic values, use rust_i18n named parameter syntax: t!("Key.Name", count => value).

貢獻者指南