How to add Localizations to a Flutter package without a MaterialApp?
Asked Answered
M

0

8

I am moving some widgets of my app into a seperated Flutter package. These widgets use AppLocalization to display localized Strings. I want to define the Strings inside the package.

In the package there is no 'entry point' in form of a MaterialApp.

Until now, I used the translations via AppLocalizations.of(context), however the context is now given by the main app. My understanding is that the app now loads the translation files defined in the app (where the context comes from) instead of the package. Is there any way how I can specify which translations to use? If not, how do you implement localized Strings inside a Flutter package, which does not contain a MaterialApp?

Mcneely answered 21/4, 2021 at 13:18 Comment(2)
Did you find a solution?Sayres
Here is explained: haashem.medium.com/localizing-flutter-packages-f722d3a814d7Whistle

© 2022 - 2024 — McMap. All rights reserved.