I have my custom library which has own localization. Then in my main app i would like to override some translations in my custom library. For example:
CustomLibrary has this translation in en.arb
:
{
"genericEmail": "E-mail",
}
In my main app i have same key but different translation:
{
"genericEmail": "Your email",
}
My custom library has a Widget which use the translation
class EmailWidget extends StatelessWidget {
const EmailWidget({super.key});
@override
Widget build(BuildContext context) {
final translate = CustomLibraryLocalizations.of(context);
return Text(translate.genericEmail);
}
}
I use EmailWidget
in my main app and i would like my main app translation replace my custom library
translation
I’ve even tried to put my Main app localizationsDelegates
first but did not work
return MaterialApp(
locale: const Locale("en"),
localizationsDelegates: const [
...AppLocalizations.localizationsDelegates,
CustomLibraryLocalizations.delegate
],
supportedLocales: const <Locale>[
...AppLocalizations.supportedLocales,
...CustomLibraryLocalizations.supportedLocales,
],
);