0

I need to add function a language selection function for my app. And it was done. The next problem is that the main language should be Russian. I do not need English right now. but intl_en.arb file is creating automatically. Hence I found another way. That is, it is possible to set the initial language with Locale('ru') inside MaterialApp or CupertinoApp. I am using CupertinoApp right now. The following error is occurring when I use the CupertinoApp.

 CupertinoApp(
              theme: theme,
              localizationsDelegates: [
                AppLocalizationDelegate(),
                DefaultMaterialLocalizations.delegate,
                DefaultCupertinoLocalizations.delegate,
                DefaultWidgetsLocalizations.delegate,
              ],
              locale: Locale('ru'),
              supportedLocales: AppLocalizationDelegate().supportedLocales,
              onGenerateRoute: Application.router.generator,
              home: state.showLogin ? LanguageController() : HomeController(),
            ),

but that is working well with Locale('en')

I've found resources from some sites to solve the problem. F.E : https://flutter.dev/docs/release/breaking-changes/text-field-material-localizations

but the result is still negative.

I think this problem is happening for only TextField. Because other texts are working.

Is there any other way?

Thank you!

  • Have you tried setting the locale with `localeListResolutionCallback`? localeListResolutionCallback: (_,__) { return Locale('id', 'ID'); }, If it does not work, you can try `easy_localization` package – Pushpendra Apr 26 '21 at 11:10
  • @Pushpendra Thanks for your response. Yes, I have tried with localeListResolutionCallback. The problem is just setting the initial language. I am using `intl` package (with [Localizely](http://Localizely.com)). I think, no need to change the package –  Apr 26 '21 at 12:02

0 Answers0