Skip to content

refactor(previews): implement preview key and i18n name#446

Merged
xrgzs merged 5 commits intoOpenListTeam:mainfrom
xrgzs:fix/previews-i18n
Apr 3, 2026
Merged

refactor(previews): implement preview key and i18n name#446
xrgzs merged 5 commits intoOpenListTeam:mainfrom
xrgzs:fix/previews-i18n

Conversation

@xrgzs
Copy link
Copy Markdown
Member

@xrgzs xrgzs commented Mar 26, 2026

Description / 描述

  1. Preview 组件标识重构为 key,并支持 i18n
  2. 增加 preview 查询参数,支持传入 Preview 组件的 key,方便直接打开对应的 Preview

Motivation and Context / 背景

Closes #442

How Has This Been Tested? / 测试

直接下载组件: ?preview=download

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

@xrgzs xrgzs added the enhancement New feature or request label Mar 26, 2026
@xrgzs xrgzs requested a review from Copilot April 3, 2026 07:50
Copy link
Copy Markdown
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

Adds i18n-backed labels for the home “preview” dropdown so built-in preview options (including Download) can be localized via the existing translation system, addressing #442.

Changes:

  • Replace hardcoded preview display names with i18n keys (home.preview.names.*) in preview list generation.
  • Refactor preview definitions to use a stable key for translation lookup.
  • Add English translations for built-in preview names under home.preview.names in src/lang/en/home.json.

Reviewed changes

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

File Description
src/pages/home/previews/index.ts Switch preview option labels from hardcoded strings to useT() translations keyed by a new Preview.key.
src/lang/en/home.json Add home.preview.names translation entries for built-in preview options.

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

xrgzs added 3 commits April 3, 2026 16:29
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
@xrgzs xrgzs force-pushed the fix/previews-i18n branch from f938629 to 082c196 Compare April 3, 2026 08:29
xrgzs added 2 commits April 3, 2026 16:40
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
@xrgzs xrgzs force-pushed the fix/previews-i18n branch from 082c196 to c606d6e Compare April 3, 2026 08:49
@xrgzs xrgzs requested review from ILoveScratch2 and PIKACHUIM April 3, 2026 09:07
@xrgzs xrgzs changed the title feat(previews): support i18n locale refactor(previews): implement preview key and i18n name Apr 3, 2026
@xrgzs xrgzs merged commit 6a1d998 into OpenListTeam:main Apr 3, 2026
1 check passed
@xrgzs xrgzs deleted the fix/previews-i18n branch April 3, 2026 09:14
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.

[Feature] Support i18n locale for download

3 participants