easy_localization
easy_localization copied to clipboard
localization key in MaterialApp
if getting locale keys from under widget MaterialApp
_translations not loaded... but in childrens all ok
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: LocaleKeys.title.tr(), /// bug _translations empty
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Easy localization'),
);
}
}
dublicate #331
minor fixed in PR #336
@aissat but the keys are loading when translations not initiliased
I/flutter (12784): [🌎 Easy Localization] [DEBUG] Localization initialized
I/flutter (12784): [🌎 Easy Localization] [DEBUG] Start
I/flutter (12784): [🌎 Easy Localization] [DEBUG] Init state
I/flutter (12784): [🌎 Easy Localization] [INFO] Start locale loaded vi
I/flutter (12784): [🌎 Easy Localization] [DEBUG] Build
I/flutter (12784): [🌎 Easy Localization] [DEBUG] Init Localization Delegate
I/flutter (12784): [🌎 Easy Localization] [DEBUG] Init provider
I/flutter (12784): [🌎 Easy Localization] [WARNING] Localization key [name] not found <--------
I/flutter (12784): [🌎 Easy Localization] [DEBUG] Load Localization Delegate
I/flutter (12784): [🌎 Easy Localization] [DEBUG] Load asset from assets/translations
Duplicate of #349 #351 #355
is there any news or workarounds for this bug?
MaterialApp's title couldn't be translated!!
is there any news or workarounds for this bug?
MaterialApp's title couldn't be translated!!
It looks like it's working with onGenerateTitle
(https://api.flutter.dev/flutter/material/MaterialApp/onGenerateTitle.html)
MaterialApp(
...
title: 'Title',
onGenerateTitle: (context) => 'title'.tr(),
...
)