Skip to content

fix(lyric): 修复 TTML 多语言翻译#719

Merged
imsyy merged 2 commits into
SPlayer-Dev:devfrom
MoYingJi:pr/p
Jan 7, 2026
Merged

fix(lyric): 修复 TTML 多语言翻译#719
imsyy merged 2 commits into
SPlayer-Dev:devfrom
MoYingJi:pr/p

Conversation

@MoYingJi
Copy link
Copy Markdown
Collaborator

@MoYingJi MoYingJi commented Jan 6, 2026

增加 sortTTMLTranslations 函数来排序翻译(此函数包含 AI 生成部分),可能确实有些问题,但也是作为临时解决方案,应该在 AMLL 的 TTML 解析器支持多语言翻译后删除

fix #718

增加 `sortTTMLTranslations` 函数来排序翻译(此函数包含 AI 生成部分),可能确实有些问题,但也是作为临时解决方案,应该在 AMLL 的 TTML 解析器支持多语言翻译后删除

fix SPlayer-Dev#718
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @MoYingJi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在解决 TTML 歌词多语言翻译的显示问题,通过引入一个临时的排序函数来确保中文翻译能够被正确识别和优先处理。这提高了用户在播放包含多语言 TTML 歌词时体验的一致性,直至上游解析器提供更完善的解决方案。

Highlights

  • 新增 TTML 翻译排序功能: 引入了一个名为 "sortTTMLTranslations" 的新私有方法,用于在解析 TTML 内容之前对多语言翻译进行排序。此函数包含 AI 生成的部分。
  • 优先处理中文翻译: "sortTTMLTranslations" 函数会根据预定义的语言顺序(如 "zh-CN", "zh-Hans", "zh-TW", "zh-Hant")对 TTML 歌词中的翻译元素进行重新排序,确保中文翻译优先显示。
  • 临时解决方案: 此功能被明确标记为临时性措施,将在 AMLL 的 TTML 解析器原生支持多语言翻译后移除。
  • 集成到 TTML 解析流程: 在 "LyricManager" 中,所有调用 "parseTTML" 的地方都已更新,以先通过 "sortTTMLTranslations" 处理 TTML 内容。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

此次更新通过增加 sortTTMLTranslations 函数,修复了 TTML 歌词多语言翻译的排序问题,这是一个有效的临时解决方案。代码逻辑清晰,通过直接操作 DOM 来重新排序翻译元素的方式也很巧妙。我的审查意见主要针对新函数 sortTTMLTranslations,提出了一些关于性能优化、代码健壮性和错误处理的建议,以使其更加可靠。

Comment thread src/core/player/LyricManager.ts
Comment thread src/core/player/LyricManager.ts
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@imsyy imsyy merged commit 04743e8 into SPlayer-Dev:dev Jan 7, 2026
@MoYingJi MoYingJi deleted the pr/p branch January 7, 2026 12:51
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.

TTML 格式中多语言翻译没有过滤操作

2 participants