gpt4 book ai didi

ios - 使用 iOS Stringsdict 文件的显式复数字符串

转载 作者:行者123 更新时间:2023-12-01 15:33:30 25 4
gpt4 key购买 nike

我开始学习 iOS Stringsdict files并在使用以下语法的项目中找到了一些现有代码:

<key>zero</key>
<string>You no message.</string>

根据 CLDR, zero在英语中是无效的复数​​形式,我们希望使用明确的复数规则(使用 ICU MessageFormat 时 =0)

我试图找到如何在 iOS Stringsdict 文件中使用显式复数规则,但找不到任何方法来实现这一点。有人可以确认这是否受支持吗?

解决方案示例(我无法测试它们,但也许有人可以?)
<key>0</key>
<string>You no message.</string>

或者
<key>=0</key>
<string>You no message.</string>

关于 ICU MessageFormat 的 CLDR 实现的显式复数规则部分的额外引用:

https://formatjs.io/guides/message-syntax/#plural-format

=value This is used to match a specific value regardless of the plural categories of the current locale.

最佳答案

如果您对 zero 感兴趣仅规则,在 .stringsdict 中处理任何语言的文件。

来源:Foundation Release Notes for OS X v10.9

If "zero" is present, the value is used for mapping the argument value zero regardless of what CLDR rule specifies for the numeric value.



否则,这些是唯一处理的规则(取决于语言): zero, one, two, few, many, others

关于ios - 使用 iOS Stringsdict 文件的显式复数字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61393880/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com