Skip to content

lyrics: add translation lyrics for netease.ts #951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 21, 2025

Conversation

et21ff
Copy link
Contributor

@et21ff et21ff commented Jun 10, 2025

What is the motivation for this change?

Currently, the NetEase lyrics provider (netease.ts) only fetches the original lyrics (lrc) and ignores available translated lyrics (tlyric). This prevents users from seeing translations for many songs, especially CJK (Chinese, Japanese, Korean) pop music, even when the translations exist on the NetEase platform.

This PR aims to resolve this issue by enabling support for translated lyrics from NetEase.

What is the new behavior?

  • The getLyricsBySongId function in netease.ts now fetches both original (lrc) and translated (tlyric) lyrics from the NetEase API.
  • If a translation is found, it is parsed and injected as new, fully-formatted LRC lines directly following their corresponding original lines.
  • For example, a single original line [00:12.34]Original Text becomes two lines in the output string:
    [00:12.34]Original Text
    [00:12.34]Translated Text
    

This approach was chosen to keep the function's public contract (Promise<string | null>) unchanged, ensuring minimal and non-breaking changes for higher chances of acceptance.

How to test the new behavior?

Check out this branch.

Run the app in production preview mode (pnpm run start).

Play a song that has a known translation on NetEase (e.g., "Lemon" by Kenshi Yonezu, ID: 536622451).

图片

Copy link

vercel bot commented Jun 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
feishin ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2025 4:16pm

@et21ff
Copy link
Contributor Author

et21ff commented Jun 10, 2025

Considering users using netease for lyric search only need a original version of lyric , adding netease_translate.ts may be a probable option

@jeffvli
Copy link
Owner

jeffvli commented Jun 10, 2025

First of all, thank you for the PR.

This functionality is useful, but it needs to be configurable to be enabled/disabled since there are users who will not want to see the included translations.

Please add a settings option in the UI under lyric-settings, which includes storing the settings value under localSettings as well to access the value in the main process.

@et21ff
Copy link
Contributor Author

et21ff commented Jun 11, 2025

First of all, thank you for the PR.

This functionality is useful, but it needs to be configurable to be enabled/disabled since there are users who will not want to see the included translations.

Please add a settings option in the UI under lyric-settings, which includes storing the settings value under localSettings as well to access the value in the main process.

the setting option is easpecially for netease lyric(cuz only netease has translation lyric) and will it be confilicting with the existing api-translate option? So i wonder weather its suitable to add it globally in the lyric-settings (or merge it). And maybe we should ask @kgarner7 for further information.

@jeffvli
Copy link
Owner

jeffvli commented Jun 11, 2025

You just need to make the new setting conditional based on if netease is selected as a lyric provider or not.

It should not conflict with any of the existing settings.

@et21ff
Copy link
Contributor Author

et21ff commented Jun 11, 2025

You just need to make the new setting conditional based on if netease is selected as a lyric provider or not.您只需要根据是否选择 netease 作为歌词提供商来制定新的条件即可。

It should not conflict with any of the existing settings.它不应该与任何现有设置冲突。

图片
change enable netease translation for test,set false by default

@jeffvli jeffvli merged commit ae41fe9 into jeffvli:development Jun 21, 2025
4 checks passed
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.

2 participants