Invalid argument(s): 无效的语言环境 “en”

huangapple go评论70阅读模式
英文:

Invalid argument(s): Invalid locale "en"

问题

我有一个支持三种语言(英语、阿拉伯语和库尔德语)的应用程序。每当我更改应用程序的选定语言时,对于任何语言都没有问题,但是当我将其更改为库尔德语然后重新启动应用程序时,导航到某些屏幕会导致以下错误。

无效参数:无效的区域设置 "en"

我不知道重新启动应用程序会对区域设置产生什么影响,但它导致了这个问题,应用程序完全停止工作。

我的委托列表:

final delegatesList = [
      GlobalMaterialLocalizations.delegate,
      GlobalCupertinoLocalizations.delegate,
      GlobalWidgetsLocalizations.delegate,
      KuMaterialLocalizations.delegate,
      KuWidgetLocalizations.delegate,
      MaterialLocalizationKuDelegate(),
      ...context.localizationDelegates,
    ];

支持的区域设置:

startLocale: const Locale("en"),
      supportedLocales: const [
        Locale("en"),
        Locale("ku"),
        Locale("ar"),
      ],
英文:

I have an application supporting Three languages (English, Arabic, and Kurdish). whenever I change the application's selected language there is no problem with any language, but when I change it to Kurdish and then restart app, navigating to certain screen causes the following error.

Invalid argument(s): Invalid locale "en"

I don't know what restarting an app does with the Locales, but it causes me this problem where the application completely stops working.

My Delegate List:

final delegatesList = [
      GlobalMaterialLocalizations.delegate,
      GlobalCupertinoLocalizations.delegate,
      GlobalWidgetsLocalizations.delegate,
      KuMaterialLocalizations.delegate,
      KuWidgetLocalizations.delegate,
      MaterialLocalizationKuDelegate(),
      ...context.localizationDelegates,
    ];

My Supported Locales:

startLocale: const Locale("en"),
      supportedLocales: const [
        Locale("en"),
        Locale("ku"),
        Locale("ar"),
      ],

答案1

得分: 1

尝试替换为 "en_US"

英文:

try to replace by "en_US"

huangapple
  • 本文由 发表于 2023年7月13日 16:29:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76677373.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定