Flutter internationalization for Japanese failed

血红的双手。 提交于 2020-06-29 05:05:11

问题


I am new to flutter. I want to get the support for Japanese language for the application. I followed the example listed here; https://medium.com/flutter-community/flutter-internationalization-the-easy-way-using-provider-and-json-c47caa4212b2

It works perfectly for Arabic language listed there, but when i try the same for Japanese. It does not work.

Only thing I did was modify to include 'jp' locale

return MaterialApp(
          locale: model.appLocal,
          supportedLocales: [
            Locale('en', 'US'),
            Locale('jp', 'JP'),
          ],
          localizationsDelegates: [
            AppLocalizations.delegate,
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
          ],
          home: AppLang(),
        );

...

@override
  bool isSupported(Locale locale) {
    // Include all of your supported language codes here
    return ['en', 'jp'].contains(locale.languageCode);
  }

getting error

I/flutter (20037): Warning: This application's locale, jp, is not supported by all of its
I/flutter (20037): localization delegates.
I/flutter (20037): > A MaterialLocalizations delegate that supports the jp locale was not found.
I/flutter (20037): See https://flutter.dev/tutorials/internationalization/ for more
I/flutter (20037): information about configuring an app's locale, supportedLocales,
I/flutter (20037): and localizationsDelegates parameters.

I found information that state there is advance locale support https://flutter.dev/docs/development/accessibility-and-localization/internationalization But no information no how to do it.

Can anyone provide some help on this?

来源:https://stackoverflow.com/questions/62540699/flutter-internationalization-for-japanese-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!