Skip to content

Commit 2cc2421

Browse files
committed
注释
1 parent 218702e commit 2cc2421

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/common/localization/DefaultLocalizations.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import 'package:gsy_github_app_flutter/common/style/GSYStringBase.dart';
55
import 'package:gsy_github_app_flutter/common/style/GSYStringEn.dart';
66
import 'package:gsy_github_app_flutter/common/style/GSYStringZh.dart';
77

8+
///自定义多语言实现
89
class GSYLocalizations {
910
final Locale locale;
1011

1112
GSYLocalizations(this.locale);
1213

14+
///根据不同 locale.languageCode 加载不同语言对应
15+
///GSYStringEn和GSYStringZh都继承了GSYStringBase
1316
static Map<String, GSYStringBase> _localizedValues = {
1417
'en': new GSYStringEn(),
1518
'zh': new GSYStringZh(),
@@ -19,6 +22,8 @@ class GSYLocalizations {
1922
return _localizedValues[locale.languageCode];
2023
}
2124

25+
///通过 Localizations 加载当前的 GSYLocalizations
26+
///获取对应的 GSYStringBase
2227
static GSYLocalizations of(BuildContext context) {
2328
return Localizations.of(context, GSYLocalizations);
2429
}

0 commit comments

Comments
 (0)