Skip to content

Conversation

@xrgzs
Copy link
Member

@xrgzs xrgzs commented Jul 16, 2025

由于从 @solid-primitives/i18n v1 升级到 @solid-primitives/i18n v2 涉及到 BREAKING CHANGE,i18n 实现彻底发生变化,因此特别手动处理

  • 平滑更新至 vite v6
  • 修复更新至 vite v6 后 es-build 检测到 useDownload.ts 中代码错误的问题
  • 平滑更新至 typescript v5
  • 更新 @solid-primitives/i18n v2
  • 适配 @solid-primitives/i18n v2 的 i18n 写法

更新后表现与更新前几乎一致

更新了 vite v6 后开发环境下默认返回 index.html,开发预览组件时更加顺心

由于 vite-plugin-solid 这个插件说它支持 vite 3/4/5/6 ,因此暂不升级 vite 7

@SenkjM SenkjM requested a review from Copilot July 16, 2025 01:49
Copy link
Contributor

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

This PR upgrades the project’s internationalization from @solid-primitives/i18n v1 to v2 and updates related tooling (Vite v6, TypeScript v5).

  • Refactored JSON language entry loading and replaced the old useI18n context with resource-based loading via createResource.
  • Updated useT and SwitchLanguage hooks to use the new v2 translator API and simplified language switching.
  • Fixed nullish concatenation bugs in useDownload.ts and bumped Vite, TypeScript, and plugin versions.

Reviewed Changes

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

Show a summary per file
File Description
src/lang/en/entry.ts Swapped dynamic glob import for explicit JSON imports; exported dict.
src/hooks/useT.ts Rewrote translation hook using i18n.translator, resolveTemplate, and custom fallback.
src/hooks/useDownload.ts Corrected token string building by adding parentheses around nullish coalescing.
src/components/SwitchLanguage.tsx Removed old useI18n logic; replaced with setCurrentLang and localStorage.
src/app/index.tsx Removed legacy I18nContext.Provider wrapper around <App />.
src/app/i18n.ts Completely overhauled i18n context to use createResource for loading and flattening dictionaries.
src/app/App.tsx Cleaned up old i18n imports and initialization in App.
package.json Bumped dependencies: Vite → v6, TypeScript → v5, @solid-primitives/i18n → v2.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

src/components/SwitchLanguage.tsx:18

  • The fetchingLang signal and its setter are declared but no longer used after refactoring. Consider removing them to avoid unused variables.
const [fetchingLang, setFetchingLang] = createSignal(false)

@xrgzs xrgzs merged commit c2dbcf2 into OpenListTeam:main Jul 16, 2025
1 check passed
@xrgzs xrgzs deleted the refactor-solid-i18n branch July 16, 2025 02:01
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