fix: 修復當沒有語言設定資料時,使用中文而不是系統語言

This commit is contained in:
JingChiang
2024-11-10 14:11:05 +08:00
parent 6aaed1ba15
commit 4c8d789a86

View File

@@ -94,7 +94,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
void _setLanguage() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String preLanguage = prefs.getString("language") ?? "";
Locale locale = preLanguage == "" ? Locale('zh_Hant') : Locale(preLanguage) ;
Locale locale = preLanguage == "" ? Localizations.localeOf(context) : Locale(preLanguage) ;
S.load(locale);
setState(() {});
}