Skip to content

Commit f79aa9e

Browse files
authored
fix: Use device locale when no preference is set (#2483)
1 parent 5127c7f commit f79aa9e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/services/manager_api.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,13 @@ class ManagerAPI {
325325
}
326326

327327
String getLocale() {
328-
return _prefs.getString('locale') ?? 'en';
328+
final String? savedLocale = _prefs.getString('locale');
329+
if (savedLocale != null && savedLocale.isNotEmpty) {
330+
return savedLocale;
331+
} else {
332+
final Locale deviceLocale = PlatformDispatcher.instance.locale;
333+
return deviceLocale.languageCode.isNotEmpty ? deviceLocale.languageCode : 'en';
334+
}
329335
}
330336

331337
Future<void> setLocale(String value) async {

0 commit comments

Comments
 (0)