ilteoood / flutter_i18n

I18n made easy, for Flutter!
MIT License
217 stars 57 forks source link

Wrong directionality using rootAppBuilder #150

Closed Amir-P closed 3 years ago

Amir-P commented 3 years ago

Hello, I noticed an issue with directionality when I was using this plugin with a forced RTL language in FileTranslationLoader. I believe the issue lies in both _findTextDirection and rootAppBuilder (flutter_i18n.dart). rootAppBuilder uses the _localeStream which is a broadcast stream, hence the StreamBuilder's builder method is not being called with the latest locale and for the first time the snapshot's data given to the builder is null. The issue with _findTextDirection is that it's using countryCode and passes that to isRtlLanguage method of intl.Bidi which clearly indicates the provided string should be Language code (BCP 47 / III).