fix: Use device locale when no preference is set (#2483)

This commit is contained in:
Chase Hays 2025-04-17 08:06:57 -05:00 committed by GitHub
parent 5127c7f599
commit f79aa9edd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -325,7 +325,13 @@ class ManagerAPI {
}
String getLocale() {
return _prefs.getString('locale') ?? 'en';
final String? savedLocale = _prefs.getString('locale');
if (savedLocale != null && savedLocale.isNotEmpty) {
return savedLocale;
} else {
final Locale deviceLocale = PlatformDispatcher.instance.locale;
return deviceLocale.languageCode.isNotEmpty ? deviceLocale.languageCode : 'en';
}
}
Future<void> setLocale(String value) async {