Fixed an issue where selected locale was not used

This commit is contained in:
2025-09-27 12:49:38 +02:00
parent 140e3a7328
commit 8ca98d4720
2 changed files with 4 additions and 7 deletions

View File

@@ -15,7 +15,6 @@ class LocaleController extends ChangeNotifier {
_current = _fromString(saved) ?? LanguagePref.system;
_applyToSlang(_current);
notifyListeners();
}
/// Sprache ändern (persistieren + sofort anwenden)
@@ -23,18 +22,15 @@ class LocaleController extends ChangeNotifier {
_current = lang;
await _prefs.setString(_key, lang.name);
print(lang);
_applyToSlang(lang);
notifyListeners();
}
void _applyToSlang(LanguagePref pref) {
if (pref == LanguagePref.system) {
LocaleSettings.useDeviceLocale();
return;
}
final code = pref.code;
if (code == null) {
if (pref == LanguagePref.system || code == null) {
LocaleSettings.useDeviceLocale();
return;
}

View File

@@ -31,6 +31,7 @@ Future<void> main() async {
final scaleController = ScaleController();
final localeController = LocaleController();
await localeController.init();
runApp(
MultiProvider(