Skip to content

Pascal Editor: Simplified Chinese localization (zh-CN) - #1022

Open
Daxiongzhang wants to merge 1 commit into
pascalorg:mainfrom
Daxiongzhang:feat/zh-cn-localization-upstream
Open

Daxiongzhang wants to merge 1 commit into
pascalorg:mainfrom
Daxiongzhang:feat/zh-cn-localization-upstream

Conversation

@Daxiongzhang

@Daxiongzhang Daxiongzhang commented Oct 9, 2026 •

Copy link
Copy Markdown

What does this PR do?

Adds a Simplified Chinese localization path while preserving English as the default:

  • adds an I18nProvider with an English/Simplified Chinese switch and persisted locale
  • adds a display-text translation boundary to @pascal-app/editor
  • localizes editor navigation, tool labels, dialogs, settings, scene management, shortcuts, and viewer controls
  • keeps scene data, registry values, IDs, and domain enums unchanged
  • adds focused tests for catalog parity and display-only translation behavior

Simplified Chinese localization contributed by Daxiongzhang.

中文说明

本 PR 为 Pascal Editor 增加简体中文界面,同时保留英文作为默认语言。

  • 这是源码级双语支持,不是独立安装的“汉化包”
  • 仅翻译界面显示文本,不修改场景数据、注册表值、ID、枚举或用户自定义名称
  • 语言选择会保存在浏览器中,刷新或下次打开时继续生效
  • PR 合并前可检出本分支体验;合并后无需单独安装汉化文件

简体中文本地化由 Daxiongzhang 贡献。

Install and try / 安装与体验

Requires Bun 1.3.14 (the version declared by this repository).

git clone https://github.com/Daxiongzhang/editor.git
cd editor
git checkout feat/zh-cn-localization-upstream
bun install --frozen-lockfile
bun dev

Open the local URL printed by bun dev, then click the language icon in the top editor toolbar to switch between English and Simplified Chinese.

打开 bun dev 输出的本地地址,然后点击编辑器顶部工具栏中的语言图标,即可切换英文与简体中文。

How to test

  1. Run bun install --frozen-lockfile, then bun dev.
  2. Use the top-toolbar language control to switch between English and Simplified Chinese.
  3. Check build tools, items, scene management, settings, dialogs, shortcuts, and viewer controls.
  4. Reload the page and confirm the selected language persists.
  5. Run bun check, bun run check-types, and bun test apps/editor/lib/i18n.test.ts packages/editor/src/lib/display-text.test.tsx.

Validation

  • bun check: passed (3,217 files; upstream warnings remain)
  • bun run check-types: passed (13/13 tasks)
  • localization tests: passed (4/4)
  • full bun run test: all completed packages passed except three CLI process-management tests, which cannot spawn macOS ps in the restricted execution environment (EPERM: operation not permitted, posix_spawn 'ps')

Screenshots / screen recording

Not attached in this initial submission. The change retains the existing editor layout and adds localized labels and a language switch.

Checklist

  • My code follows the existing code style (bun check)
  • The localization and type checks pass
  • This PR targets the main branch

@Daxiongzhang Daxiongzhang changed the title feat(i18n): add Simplified Chinese localization feat(i18n): add Simplified Chinese localization [zh-CN, Daxiongzhang] Oct 9, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 23b1703. Configure here.

Comment thread apps/editor/lib/i18n.tsx
document.documentElement.lang = locale
localStorage.setItem(STORAGE_KEY, locale)
document.cookie = `${STORAGE_KEY}=${locale}; path=/; max-age=31536000; samesite=lax`
}, [locale])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Locale persistence overwrites saved preference

Medium Severity

I18nProvider starts at en and the persist effect writes localStorage and the pascal.locale cookie on that first value before the restore effect applies the saved locale. Under React Strict Mode that default write is read back on remount, so a stored zh-CN choice can reset to English.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 23b1703. Configure here.

Comment thread apps/editor/app/page.tsx
const sidebarTabs = SIDEBAR_TABS.map((tab) => ({
...tab,
label: translateDisplayText(tab.label),
}))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sidebar tabs use the wrong catalog

Medium Severity

Home sidebar labels go through translateDisplayText instead of the typed sidebar.* keys. Scene and Settings have no display-map entries and stay English, while Build resolves to 建筑 rather than 建模.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 23b1703. Configure here.

}}
onMouseEnter={() => triggerSFX('sfx:menu-hover')}
title={type.label}
title={translateDisplayText(type.label)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Roof UI ignores prepared translation keys

Medium Severity

ROOF_TYPE_OPTIONS now carries labelKey values, and catalogs include build.roofType, build.roofFeatures, and roof.conicalHint, but the Build tab still renders the English label plus hardcoded section copy. Roof type controls stay English in Simplified Chinese.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 23b1703. Configure here.

@Daxiongzhang Daxiongzhang changed the title feat(i18n): add Simplified Chinese localization [zh-CN, Daxiongzhang] feat(i18n): add Simplified Chinese localization to Pascal Editor [zh-CN, Daxiongzhang] Oct 9, 2026
@Daxiongzhang Daxiongzhang changed the title feat(i18n): add Simplified Chinese localization to Pascal Editor [zh-CN, Daxiongzhang] Pascal Editor: Simplified Chinese localization (zh-CN) Oct 9, 2026

This branch has not been deployed

No deployments
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.

1 participant