flutter 日本人的国际化失败

9rnv2umw  于 2023-05-19  发布在  Flutter
关注(0)|答案(2)|浏览(155)

我是新来的。我想得到日语的应用程序的支持。我遵循了这里列出的示例; https://medium.com/flutter-community/flutter-internationalization-the-easy-way-using-provider-and-json-c47caa4212b2
它完美地适用于那里列出的阿拉伯语,但当我尝试同样的日语。它不起作用。
我做的唯一一件事是修改包括'jp'地区

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);
  }

获取误差

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.

我找到了信息,说明有先进的语言环境支持https://flutter.dev/docs/development/accessibility-and-localization/internationalization,但没有信息,也没有如何做到。
有人能在这方面提供一些帮助吗?

dsekswqp

dsekswqp2#

Flutter本地化支持在IANA Language Subtag Registry中注册的语言代码。对于日语,语言类型的代码应为ja

相关问题