如果不支持该设备的语言,是否有一种方法可以强迫格式化使用英语?

发布于 2025-02-03 02:12:32 字数 706 浏览 4 评论 0 原文

我们在应用程序中大量使用格式化器,以获取数字和日期/时间。而且我们发现,当设备的语言是阿拉伯语时,该应用看起来不太好,例如,这是我们不支持的语言。例如,请参阅此屏幕截图,例如,对于设备的语言,具有阿拉伯语设置的设备(没有其他语言添加到设备的首选项中):

“在此处输入图像描述”

局部免费试用期在阿拉伯语中显示。底部的数字。以及应用程序中的所有日期/时间也以阿拉伯语为单位。

英语被视为开发语言,但这似乎还不够。然后我阅读和我的理解是,英语应该是将其设置为开发语言的语言。

格式化/本地化方法也不遵守相同的规则吗?

如果应用程序不支持设备的语言,是否有一种方法可以强制使用英语/本地化方法使用英语?

编辑: 只需将设备的语言切换到日语和俄语,同样的观点完全可以根据需要用英语显示出来,因此不确定问题到底是什么。

We make heavy use of formatters in the app for numbers and date/time. And we found out that the app doesn't look nice when the device's language is Arabic for example, which is a language we don't support. See this screenshot for example for a device with Arabic set as the device's language (no other languages added to device's preferences):

enter image description here

The localised free trial period is shown in Arabic. The numbers at the bottom as well. And all dates/times in the app show in Arabic as well.

English is set as the development language, but that doesn't seem to be enough. And I read How iOS Determines the Language For Your App and my understanding is that English should've been the language used as it is set as the development language.

Do formatters/localisation methods not follow the same rules as well?

Is there a way to force formatters/localisation methods to use English if the device's language is not supported by the app?

Edit:
Just switched the device's language to Japanese and Russian and the same view showed completely in English, as desired, so not sure what exactly the issue is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哥,最终变帅啦 2025-02-10 02:12:32

是的,您可以指定格式化器的 locale

let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en")

Yes you can specify the Locale of a formatter:

let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文