Skip to content

feat: Add Vietnamese (vi) localization support#2358

Merged
Hmbown merged 6 commits into
Hmbown:mainfrom
hoclaptrinh33:feat/vietnamese-localization
May 31, 2026
Merged

feat: Add Vietnamese (vi) localization support#2358
Hmbown merged 6 commits into
Hmbown:mainfrom
hoclaptrinh33:feat/vietnamese-localization

Conversation

@hoclaptrinh33
Copy link
Copy Markdown
Contributor

@hoclaptrinh33 hoclaptrinh33 commented May 29, 2026

This PR adds full Vietnamese translation support to CodeWhale TUI, updates documentation and locale configuration, and creates the README.vi.md.

Greptile Summary

This PR adds full Vietnamese (vi) localization support: a new Locale::Vi enum variant with ~400 translated strings, locale system-prompt preambles, a Vietnamese README, and updates to the onboarding language-picker footer text ("1-7") across all existing translations.

  • localization.rs: Adds the Vi variant to the Locale enum, removes vi from PLANNED_QA_LOCALES, supplies a complete vietnamese() translation function, and bumps all OnboardLanguageFooter strings from "1-6" → "1-7".
  • prompts.rs: Adds LOCALE_PREAMBLE_VI / LOCALE_CLOSER_VI system-prompt constants and wires Vietnamese into the reinforcement and translation-target helpers.
  • onboarding/language.rs: LANGUAGE_OPTIONS was not updated — it still only defines six hotkeys (1–6), so the new "1-7" footer hint is misleading and hotkey 7 silently does nothing in the first-run picker.

Confidence Score: 4/5

Safe to merge after fixing the missing LANGUAGE_OPTIONS entry so that the onboarding picker's hotkey '7' actually selects Vietnamese.

The translation work itself is thorough and correctly wired throughout the codebase. The one concrete defect is that LANGUAGE_OPTIONS in the first-run language picker was not updated to include Vietnamese, leaving the 'Press 1-7' footer text pointing to a non-functional hotkey.

crates/tui/src/tui/onboarding/language.rs — LANGUAGE_OPTIONS needs a Vietnamese entry added.

Important Files Changed

Filename Overview
crates/tui/src/tui/onboarding/language.rs LANGUAGE_OPTIONS not updated to include Vietnamese ('7'), so the footer hint '1-7' is inaccurate and the hotkey is unreachable at runtime.
crates/tui/src/localization.rs Adds Locale::Vi variant with full translation coverage; promotes vi from PLANNED_QA_LOCALES to the active enum; updates OnboardLanguageFooter to '1-7' across all locales; removes vi from the planned-only constant.
crates/tui/src/prompts.rs Adds LOCALE_PREAMBLE_VI and LOCALE_CLOSER_VI system-prompt constants and wires them into locale_reinforcement_preamble/closer; adds Vietnamese branch to translation_target_language_for_tag. Changes look correct and consistent with other locales.
docs/LOCALIZATION.md Promotes both es-419 and vi from the planned table to the shipped table; adds example locale config entries. Note: es-419 is also absent from LANGUAGE_OPTIONS (pre-existing gap).
README.vi.md New Vietnamese README; accurately documents installation, configuration, and features with correct config path (~/.codewhale/config.toml) and up-to-date content.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[First-run onboarding\nOnboardingState::Language] --> B[User presses digit key 1-7]
    B --> C{LANGUAGE_OPTIONS.find\nhotkey == pressed key}
    C -- found --> D[set_locale_from_onboarding\ntag]
    C -- not found\ne.g. '7' for vi --> E[Silent no-op\nhotkey ignored]
    D --> F[advance_onboarding_after_language]
    F --> G[API key step / trust step]

    subgraph LANGUAGE_OPTIONS [LANGUAGE_OPTIONS current state]
        L1["'1' auto"]
        L2["'2' en"]
        L3["'3' ja"]
        L4["'4' zh-Hans"]
        L5["'5' zh-Hant"]
        L6["'6' pt-BR"]
        L7["'7' missing vi entry"]
    end

    style L7 fill:#f66,color:#fff
    style E fill:#f66,color:#fff
Loading

Fix All in Codex Fix All in Claude Code Fix All in Cursor

Reviews (3): Last reviewed commit: "fix(localization): finish Vietnamese loc..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds full Vietnamese language support (vi) to CodeWhale, including a new Vietnamese README, UI localization strings, and locale reinforcement prompts. It also updates documentation to reflect that both Vietnamese and Latin American Spanish (es-419) are now fully shipped locales. The review feedback suggests two minor translation improvements: updating the onboarding language picker footer to instruct users to press keys 1-7 (instead of 1-6) to account for the new locale, and refining a Vietnamese phrasing in the system prompt reinforcement to make it more idiomatic.

Comment thread crates/tui/src/localization.rs
Comment thread crates/tui/src/prompts.rs
mã nguồn, đường dẫn tệp, tên công cụ (ví dụ `read_file`, `exec_shell`), biến môi trường, \
tham số dòng lệnh và URL giữ nguyên dạng gốc —— chỉ các văn bản giải thích bằng ngôn ngữ \
tự nhiên mới được chuyển sang tiếng Việt.\n\n\
Nếu người dùng chuyển sang ngôn ngữ khác trong phiên làm việc, hãy chuyển theo từ lượt tiếp theo. \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrasing "hãy chuyển theo từ lượt tiếp theo" is slightly unnatural in Vietnamese. It is more idiomatic and precise to say "hãy chuyển sang ngôn ngữ đó từ lượt tiếp theo" (switch to that language from the next turn).

Suggested change
Nếu người dùng chuyển sang ngôn ngữ khác trong phiên làm việc, hãy chuyển theo từ lượt tiếp theo. \
Nếu người dùng chuyển sang ngôn ngữ khác trong phiên làm việc, hãy chuyển sang ngôn ngữ đó từ lượt tiếp theo. \

Comment thread README.md
Comment thread crates/tui/src/localization.rs Outdated
Comment thread crates/tui/src/localization.rs
hoclaptrinh33 and others added 3 commits May 29, 2026 23:24
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 31, 2026

how wonderful - thank you for making this PR! I'll work on getting this in for the next version

@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 31, 2026

I pushed a small maintainer follow-up to keep this moving: merged current main, added the missing Vietnamese right-click context-menu strings, updated the onboarding language footer to 1-7 across shipped locales, and kept the provider help text DeepSeek-first (deepseek | nvidia-nim | ollama).

Local verification on the updated branch:

  • cargo fmt --all -- --check
  • CARGO_TARGET_DIR=/Volumes/VIXinSSD/codewhale/target-pr2358-head cargo test -p codewhale-tui localization -- --nocapture
  • CARGO_TARGET_DIR=/Volumes/VIXinSSD/codewhale/target-pr2358-head cargo check -p codewhale-tui --all-features --locked

Thank you again @hoclaptrinh33. This is a lovely addition; I am watching the refreshed checks now and will merge it once GitHub agrees.

@Hmbown Hmbown merged commit fc9a32b into Hmbown:main May 31, 2026
2 checks passed
@hoclaptrinh33
Copy link
Copy Markdown
Contributor Author

Awesome! Thank you so much for reviewing and helping me merge this PR. I'm glad to contribute to CodeWhale. If there are any issues or updates needed for the Vietnamese localization in the future, please let me know. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants