easy_localization
easy_localization copied to clipboard
Unable to load asset
On IOS when I change the device language of the device multiple time I get the following error
The whole app doesn't work and I even need to uninstall to get it working again. It doesn't matter which language I switch to. Usually it happens after 3 to 6 times switching language.
I wrap my app widget with the EasyLocalization
runApp(
EasyLocalization(
supportedLocales: [
Locale('af'),
Locale('da'),
Locale('de'),
Locale('el'),
Locale('en'),
Locale('es'),
Locale('fi'),
Locale('fr'),
Locale('hu'),
Locale('id'),
Locale('it'),
Locale('ms'),
Locale('nb'),
Locale('nl'),
Locale('pl'),
Locale('pt'),
Locale('ru'),
Locale('sv'),
Locale('tr'),
],
path: 'assets/translations',
useOnlyLangCode: true,
fallbackLocale: Locale('en'),
child: _App( ),
),
);
And I have all my json files in assets/translations. I import the translations like this
flutter:
uses-material-design: true
assets:
- assets/images/
- assets/translations/
- assets/translations/notifications/
I've the same problem, any solution please
Did you add
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>nb</string>
</array>
to the Info.plist file?
Edit: You need to add the codes of the languages you support here.
I don't know if it'll help in your case but I was having the same problem when I was deploying on the web and it was that file name and the locale declaration is case sensitive. Eg. Locale('pt', 'br')
the file name should also be pt-br.json
and not pt-BR.json
, so your translation file names should follow how you declared them in "Locale".
Closing since there was no feedback on a potential solution