import 'dart:ui'; Locale? resolveSystemLocale(Locale systemLocale) { final lang = systemLocale.languageCode.toLowerCase(); final script = systemLocale.scriptCode; final country = systemLocale.countryCode; if (lang == 'en') { return const Locale('en'); } if (lang == 'zh') { if (script == 'Hant' || country == 'TW' || country == 'HK' || country == 'MO') { return const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'); } return const Locale('zh'); } return null; } Locale getSystemLocale() { return PlatformDispatcher.instance.locale; }