英文:
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"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论