fix(metadata): send Accept-Language on Deezer requests so names follow the app language

Deezer localizes artist and genre names by IP geolocation when no language
is given, so users behind e.g. Arabic-region IPs got Arabic metadata on an
English device (VPN 'fixed' it). The app's display language is now pushed
to the backend and sent as Accept-Language, with an en-US default.

Fixes #480
This commit is contained in:
zarzet
2026-07-14 15:46:33 +07:00
parent 9ac10dd6bb
commit 3833a66bf6
5 changed files with 51 additions and 0 deletions
+7
View File
@@ -75,6 +75,13 @@ class _MainShellState extends ConsumerState<MainShell>
setPlaybackNormalizationEnabled(
ref.read(settingsProvider).playbackNormalization,
);
// Deezer & co. localize artist/genre names by IP unless told the app's
// language (issue #480).
unawaited(
PlatformBridge.setMetadataLanguage(
Localizations.localeOf(context).toLanguageTag(),
),
);
}
@override
+8
View File
@@ -1210,6 +1210,14 @@ class PlatformBridge {
} catch (_) {}
}
/// Tells the backend the app's display language so metadata providers
/// localize by it instead of IP geolocation. Best-effort.
static Future<void> setMetadataLanguage(String tag) async {
try {
await _channel.invokeMethod('setMetadataLanguage', {'tag': tag});
} catch (_) {}
}
static Future<int> getGoLogCount() async {
final result = await _channel.invokeMethod('getLogCount');
return result as int;