发布于 2020-07-26 05:28:05
以这种方式在MaterialApp中设置委托:
MaterialApp(
// Localization
localizationsDelegates: [
FlutterI18nDelegate(
translationLoader: FileTranslationLoader(...parameters...),
missingTranslationHandler: (key, locale) {
print("--- Missing Key: $key, languageCode: ${locale.languageCode}");
},
),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
S.delegate, // Other delegate
],
supportedLocales: S.delegate.supportedLocales, // List of lang codes.
// End Localization
debugShowCheckedModeBanner: false
)
https://api.flutter.dev/flutter/material/MaterialApp/localizationsDelegates.html
https://stackoverflow.com/questions/63096081
复制相似问题