Flutterando / localization

Localization package
MIT License
33 stars 17 forks source link

Resouce load is not syn with setlocal #9

Open joyhope opened 1 year ago

joyhope commented 1 year ago

As the demo,

changeLocale(Locale locale) { setState(() { _locale = locale; }); }

The widget application will switch the localization display.

but Text("xxx".i18n()), the i18n resource load may failure because

Future changeLanguage(Locale locale, List<String> directories) async { clearSentences(); for (var directory in directories) { await _changeLanguage(locale, directory); } }

This is asyn, the clearSentences() will execture, but the resource has not loaded.

But the String read(String key, List<String> arguments) { if (!_sentences.containsKey(key)) { return key; <<== the problem here. }

Am i right?