Skip to content

feat: Add Traditional Chinese support and skip Google Antigravity #18

Open
chingleel17 wants to merge 1 commit intovbgate:mainfrom
chingleel17:feature/add-zh-tw-support
Open

feat: Add Traditional Chinese support and skip Google Antigravity #18
chingleel17 wants to merge 1 commit intovbgate:mainfrom
chingleel17:feature/add-zh-tw-support

Conversation

@chingleel17
Copy link

Changes

  • Add support for Traditional Chinese (zh-tw) locale detection and translations
  • Skip Google Antigravity query when configuration file is missing (instead of throwing error)

Why

  • Better localization for Traditional Chinese users
  • Avoid errors for users who don't have Antigravity configured

Testing

  • Verified locale detection works for zh-TW
  • Confirmed mystatus tool skips Google query gracefully when file missing

…oogle antigravity account file

- Added zh-tw language key and translations to plugin/lib/i18n.ts
- Enhanced detectLanguage() to properly detect zh-TW/zh-Hant locales and env vars
- Fixed Google quota query to silently skip missing antigravity-accounts.json instead of throwing ENOENT errors (vbgate#13)
Copilot AI review requested due to automatic review settings February 28, 2026 08:44
@chingleel17 chingleel17 changed the title "feat: Add Traditional Chinese support and skip Google Antigravity feat: Add Traditional Chinese support and skip Google Antigravity Feb 28, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Traditional Chinese (zh-tw) localization support to the mystatus plugin and makes the Google Antigravity quota query gracefully skip when its config file is missing.

Changes:

  • Extend language detection to recognize Traditional Chinese locales and add zh-tw translations.
  • Update Google quota querying to treat a missing Antigravity accounts file as “not configured” rather than an error.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
plugin/lib/i18n.ts Adds zh-tw language option, detection rules, and Traditional Chinese translation strings.
plugin/lib/google.ts Skips Google Antigravity querying when the config file is missing (ENOENT).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to 29
if (intlLocale.startsWith("zh-TW") || intlLocale.startsWith("zh-Hant")) return "zh-tw";
if (intlLocale.startsWith("zh")) return "zh";
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

detectLanguage() maps env var zh_HK to zh-tw, but the Intl-based path doesn’t handle locales like zh-HK (common) and will fall through to the generic zh check. Consider treating zh-HK as Traditional Chinese too (or more generally, detect script Hant / region TW|HK consistently for the Intl branch).

Suggested change
if (intlLocale.startsWith("zh-TW") || intlLocale.startsWith("zh-Hant")) return "zh-tw";
if (intlLocale.startsWith("zh")) return "zh";
// 规范化 locale(将下划线替换为连字符),并解析 BCP 47 子标签
const normalizedLocale = intlLocale.replace(/_/g, "-");
const parts = normalizedLocale.split("-");
const baseLang = parts[0]?.toLowerCase();
if (baseLang === "zh") {
const subtags = parts.slice(1).map((p) => p.toLowerCase());
// 传统中文:脚本为 Hant 或地区为 TW/HK
if (
subtags.includes("hant") ||
subtags.includes("tw") ||
subtags.includes("hk")
) {
return "zh-tw";
}
return "zh";
}

Copilot uses AI. Check for mistakes.
// ============================================================================

export type Language = "zh" | "en";
export type Language = "zh" | "zh-tw" | "en";
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

Adding "zh-tw" to Language means any existing currentLang === "zh" ? ... : ... branches will now incorrectly treat Traditional Chinese users as non-Chinese (e.g., plugin/lib/google.ts returns English "reset" for zh-tw). Please audit/update those conditionals (or centralize via a helper like “isChinese”) so zh-tw gets the intended Chinese output.

Copilot uses AI. Check for mistakes.
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