mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-11 21:15:37 +02:00
fix: Use device locale when no preference is set (#2483)
This commit is contained in:
parent
5127c7f599
commit
f79aa9edd7
1 changed files with 7 additions and 1 deletions
|
@ -325,7 +325,13 @@ class ManagerAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getLocale() {
|
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 {
|
Future<void> setLocale(String value) async {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue