Skip to content

Commit 2bfb7e8

Browse files
epouCopilot
andauthored
use application supportedLocales (#646)
* use application supportedLocales * Update lib/utils/MyLocalizationsDelegate.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2 parents 0d35b6d + 04146f4 commit 2bfb7e8

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

lib/utils/MyLocalizationsDelegate.dart

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:mosquito_alert_app/utils/UserManager.dart';
22
import 'package:mosquito_alert_app/utils/Utils.dart';
33

44
import 'MyLocalizations.dart';
5+
import 'Application.dart';
56
import 'package:flutter/material.dart';
67

78
class MyLocalizationsDelegate extends LocalizationsDelegate<MyLocalizations> {
@@ -10,29 +11,8 @@ class MyLocalizationsDelegate extends LocalizationsDelegate<MyLocalizations> {
1011
const MyLocalizationsDelegate({this.newLocale});
1112

1213
@override
13-
bool isSupported(Locale locale) => [
14-
'bg',
15-
'ca',
16-
'de',
17-
'el',
18-
'en',
19-
'es',
20-
'fr',
21-
'hr',
22-
'hu',
23-
'it',
24-
'lb',
25-
'mk',
26-
'nl',
27-
'pt',
28-
'ro',
29-
'ru',
30-
'sl',
31-
'sq',
32-
'sr',
33-
'tr',
34-
'zh',
35-
].contains('${locale.languageCode}');
14+
bool isSupported(Locale locale) =>
15+
application.supportedLocales().any((l) => l.languageCode == locale.languageCode);
3616

3717
@override
3818
Future<MyLocalizations> load(Locale locale) async {

0 commit comments

Comments
 (0)