Skip to content

Replace hard-coded localization file with a dedicated i18n library #3537

Description

@hongqitai

Problem

The localization strings in the current project are centralized in crates/tui/src/localization.rs. This file has exceeded 5,000 lines and is entirely hard-coded, which may lead to low maintainability, affect compilation speed, and create difficulties in using translation toolchains.

Proposed solution

Consider introducing a mature Rust i18n library, such as fluent-rs or rust-i18n, and moving the localization translations to dedicated localization files.

Impact

  • Increased dependencies: Adding 2–3 new crates, but they are mature and well-maintained. This will slightly increase build dependencies, yet the benefits far outweigh the costs.
  • Performance overhead: Most i18n libraries have been thoroughly optimized, so the performance difference compared to hard‑coded strings should be negligible.
  • Migration effort: The workload is relatively large and may introduce logic changes, so a detailed refactoring plan needs to be discussed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions