File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,14 @@ import 'package:gsy_github_app_flutter/common/style/GSYStringBase.dart';
55import 'package:gsy_github_app_flutter/common/style/GSYStringEn.dart' ;
66import 'package:gsy_github_app_flutter/common/style/GSYStringZh.dart' ;
77
8+ ///自定义多语言实现
89class 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 }
You can’t perform that action at this time.
0 commit comments