mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-29 15:28:48 +02:00
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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user