fix: route source-error message through i18n

This commit is contained in:
KhooLy 2026-07-29 16:34:48 +03:00
parent 1d933cdf65
commit a26db79594
3 changed files with 4 additions and 2 deletions

View file

@ -11,7 +11,7 @@ import type { AppState } from '../core/types';
function presentNativePlayerError(message: string): string {
const sourceFailure = /\b(loading failed|failed to open|http(?:\s+error)?|403|401|forbidden|unauthorized|not found|timed?\s*out|connection (?:refused|reset|failed)|network|no such host|certificate)\b/i.test(message);
if (!sourceFailure) return message;
return `Source error: the selected stream is unavailable, expired, or blocked.\n${message}`;
return t('player.source_error_detail', message);
}
export function usePlayerNativeEvents({
@ -55,7 +55,7 @@ export function usePlayerNativeEvents({
void (async () => {
const proxyDetail = await playerLastStreamError();
const message = proxyDetail
? `Source error: the selected stream is unavailable, expired, or blocked.\n${proxyDetail}`
? t('player.source_error_detail', proxyDetail)
: presentNativePlayerError(event.payload);
await onPlayerError(message);
})();

View file

@ -492,6 +492,7 @@
"format.remaining_almost_done": "Almost done",
"format.seconds": "%s seconds",
"player.audio": "Audio",
"player.source_error_detail": "Source error: the selected stream is unavailable, expired, or blocked.\n%s",
"player.subtitles": "Subtitles",
"player.subtitles_off": "Off",
"player.speed": "Speed",

View file

@ -492,6 +492,7 @@
"format.remaining_almost_done": "Bitiş yakın",
"format.seconds": "%s saniye",
"player.audio": "Ses",
"player.source_error_detail": "Kaynak hatası: seçilen yayın kullanılamıyor, süresi dolmuş veya engellenmiş.\n%s",
"player.subtitles": "Altyazı",
"player.subtitles_off": "Kapalı",
"player.speed": "Hız",