maotoumao/MusicFree · info

当前歌曲无翻译

Error message

当前歌曲无翻译

What it means

Hardcoded Chinese warning '当前歌曲无翻译' ('current song has no translation') shown when tapping the translation toggle while the loaded lyrics contain no translation track. It is guarded by hasTranslation, so it fires only when the toggle is pressed without translation data.

Source

Thrown at src/pages/musicDetail/components/content/lyric/lyricOperations.tsx:104

                    //     });
                    // } else {
                    showPanel("SearchLrc", {
                        musicItem: currentMusic,
                    });
                    // }
                }}
            />
            <TranslationIcon
                width={iconSizeConst.normal}
                height={iconSizeConst.normal}
                opacity={!hasTranslation ? 0.2 : showTranslation ? 1 : 0.5}
                color={
                    showTranslation && hasTranslation ? colors.primary : "white"
                }
                // style={}
                onPress={() => {
                    if (!hasTranslation) {
                        Toast.warn("当前歌曲无翻译");
                        return;
                    }

                    PersistStatus.set(
                        "lyric.showTranslation",
                        !showTranslation,
                    );
                    scrollToCurrentLrcItem();
                }}
            />
            <Icon
                name="ellipsis-vertical"
                size={iconSizeConst.normal}
                color={"white"}
                onPress={() => {
                    const currentMusic = TrackPlayer.currentMusic;
                    if (currentMusic) {
                        showPanel("MusicItemLyricOptions", {

View on GitHub (pinned to d118b18b3d)

Solutions

  1. Pick a lyric source that provides translations for this track
  2. Wait for/verify the translation lyric finished loading before toggling
  3. Localize the hardcoded string via i18n(t(...)) for consistency

Example fix

// before
Toast.warn("当前歌曲无翻译");
// after
Toast.warn(t("toast.noTranslationForCurrentMusic"));
Defensive patterns

Strategy: validation

Validate before calling

if (!hasTranslation) {
    Toast.warn(t('toast.noTranslationForCurrentMusic'));
    return;
}

Type guard

function hasTranslationLyric(l: ILyric | null): boolean {
    return !!l?.translation && Object.keys(l.translation).length > 0;
}

Prevention

When it happens

Trigger: Pressing the translation button when hasTranslation is false — the current lyric source returned only an original lyric line set with no translation entries.

Common situations: Track's lyric provider does not supply translations; online lyric fetched lacks the translation field; lyrics loaded before translation fetch completed.

Related errors


AI-assisted analysis of maotoumao/MusicFree@d118b18b3d (2026-08-30). Data as JSON: /api/errors/8a63fc7d37c3da08. Report an issue: GitHub.