Skip to content

feat: 添加 i18n 支持#14

Merged
zhxycn merged 2 commits into
mainfrom
feat/i18n
May 16, 2026
Merged

feat: 添加 i18n 支持#14
zhxycn merged 2 commits into
mainfrom
feat/i18n

Conversation

@zhxycn
Copy link
Copy Markdown
Member

@zhxycn zhxycn commented May 16, 2026

No description provided.

@zhxycn zhxycn self-assigned this May 16, 2026
@zhxycn zhxycn added the enhancement New feature or request label May 16, 2026
@zhxycn zhxycn merged commit b2f9340 into main May 16, 2026
1 check passed
@zhxycn zhxycn deleted the feat/i18n branch May 16, 2026 17:50
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 265e8e36d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread services/calendar-sync.ts
const found = calendars.find((c) => c.title === CALENDAR_TITLE);
// Match by either the current locale's title or the legacy zh title so we
// can clean up stale calendars after a language switch.
const candidates = new Set([t("calSync.title"), "掌上吾理-我的课表"]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include the English calendar title when cleaning up

When a user syncs the calendar while the app is in English, the calendar is created as iWUT - My timetable; after switching back to Chinese/system-Chinese, this lookup only matches the current Chinese title plus the legacy Chinese title, so the English calendar is not deleted and a second calendar with duplicate events is created. Include every localized app-calendar title in this candidate set, not just the current locale and the old Chinese title.

Useful? React with 👍 / 👎.

Comment thread modules/locale/index.ts
getSystemLanguageTag(): string | null;
}

const LocaleModule = requireNativeModule<LocaleNativeModule>("LocaleSwitcher");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Defer the locale native module lookup

In environments where LocaleSwitcher is not linked, such as Expo Go/Jest/web builds, importing @/lib/i18n/bootstrap at app startup imports this module and requireNativeModule throws immediately, before the try/catch in getSystemLanguageTag or the .catch() around setApplicationLocales can run. Since the new code explicitly intends to tolerate an unavailable native module, use an optional/lazy lookup so RN-side translations can still start without the native module.

Useful? React with 👍 / 👎.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant