Refactor: move Contact UI labels to l10n extension; rename raw getter to typeLabelRaw

This commit is contained in:
Serge Tarkovski
2026-04-25 00:29:20 +03:00
parent 6ae3f612ae
commit b7d0db8d1c
14 changed files with 74 additions and 39 deletions
+12
View File
@@ -6,6 +6,14 @@ import '../utils/platform_info.dart';
class BackgroundService {
bool _initialized = false;
String? Function()? _languageOverrideProvider;
/// Allows the app to expose its current language override (e.g. from
/// AppSettingsService) so the foreground notification matches the app UI
/// language instead of only the system locale.
void setLanguageOverrideProvider(String? Function()? provider) {
_languageOverrideProvider = provider;
}
Future<void> initialize() async {
if (!PlatformInfo.isAndroid || _initialized) return;
@@ -47,6 +55,10 @@ class BackgroundService {
Future<AppLocalizations> _loadLocalizations() async {
final supported = AppLocalizations.supportedLocales;
final override = _languageOverrideProvider?.call();
if (override != null && override.isNotEmpty) {
return AppLocalizations.delegate.load(Locale(override));
}
final system =
WidgetsBinding.instance.platformDispatcher.locale;
final match = basicLocaleListResolution(