Closed nerd0geek1 closed 4 years ago
close #1
LocalizationsDelegate<T>
MaterialApp.localizationsDelegates
L10n/AppLocalizations
L10n.of(context).hoge
flutter pub run intl_translation:extract_to_arb
message_**.dart
message_all.dart
en | ja
close #1
やったこと
登場人物
LocalizationsDelegate<T>
:これの継承クラスをMaterialApp.localizationsDelegates
にセットすることで多言語対応が可能になるL10n/AppLocalizations
:👆のTに相当。L10n.of(context).hoge
)L10n/AppLocalizations
からflutter pub run intl_translation:extract_to_arb
で生成されるファイル郡。各言語ごとの文言を格納する。これらのファイル群を元にmessage_**.dartが生成されるので、最終的には不要になる?message_**.dart
message_all.dart
は他のmessage_**.dart
を読み込み、Localeを元に分岐をかけるmessage_**.dart
は**(例:en | ja
)ごとの文言を格納する。参考