- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 iOS 编程中的 .stringsdict 功能来显示数字的正确序数后缀(st、nd、rd 等...)。我已经为英语创建了 .stringsdict 文件,但它只使用“一个”和“其他”键。它忽略了“两个”和“几个”选项。有人看到我在这里做错了什么吗?
文件看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TEAM_RANK_ORDINAL</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@ordinal_string@</string>
<key>ordinal_string</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>lu</string>
<key>one</key>
<string>%lust</string>
<key>two</key>
<string>%lund</string>
<key>few</key>
<string>%lurd</string>
<key>other</key>
<string>%luth</string>
</dict>
</dict>
</dict>
</plist>
然后我从 Swift 中像这样访问它。对于值 1,它附加 st,但每隔一个数字附加 th:
let fmt = NSLocalizedString("TEAM_RANK_ORDINAL", comment: "")
for i in 0...30 {
println(String(format: fmt, i))
}
最佳答案
英语语言环境忽略“两个”和“几个”规则并使用只有“一个”和“其他”。
参见 Plural Rule Properties在“国际化和本地化指南”中:
The meaning of the categories is language-dependent, and not all languages have the same categories.
For example, English only uses the
one
, andother
categories to represent plural forms. Arabic has different plural forms for thezero
,one
,two
,few
,many
, andother
categories. ...
(据我所知)没有办法使用 .stringsdict 文件用于生成序号。
关于iOS .stringsdict 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46095466/
我正在尝试使用 iOS 编程中的 .stringsdict 功能来显示数字的正确序数后缀(st、nd、rd 等...)。我已经为英语创建了 .stringsdict 文件,但它只使用“一个”和“其他”
我在 iOS 应用程序中使用 stringsdict 功能进行本地化。该应用程序是英文的,正在本地化为法语。因此,我有一个英语版本作为基础,一个法语版本用于翻译。 如果作为用户,我将我的语言设置为其他
我正在尝试使用 iOS 编程中的 .stringsdict 功能来显示数字的正确序数后缀(st、nd、rd 等...)。我已经为英语创建了 .stringsdict 文件,但它只使用“一个”和“其他”
有没有办法从 stringsdict 文件中提取本地化单词以在代码中执行字符串比较? 例如 NSStringLocalizedFormatKey:%@ 和 %#@lu_total_users@ 评论了
我正在 iOS 项目和我的 Localizable.stringsdict 文件中进行波兰语本地化,我得到了 key : general_people_number NSStringLoca
我正在为复数规则进行本地化。我创建了 plural.stringsdict 文件并添加到项目的目标中。我勾选了复选框以将文件本地化为英语。我还有 localisable.strings 文件。在 iO
我有一个 stringdict 和下面的句子我想翻译成多种语言: myKey NSStringLocalizedFormatKey My friend %#@name@ has %#
我正在寻找一种无线更新 stringsdict 本地化文件的方法,而无需在应用商店中发布新版本。所以理想情况下,我希望我的 stringdict 文件位于网络服务器上,iOS 应用程序应该从网站下载这
我开始学习 iOS Stringsdict files并在使用以下语法的项目中找到了一些现有代码: zero You no message. 根据 CLDR,zero在英语中是无效的复数形式,我们
在我的 iOS 应用程序中,我在其中一个屏幕上使用了一个标签,标签上的文本应该根据对象的数量而变化:一个苹果、两个苹果S 等等。我创建了 Localizable.stringdict 文件:
使用 .stringsdict 时遇到一些问题。代码如下: groups-selected NSStringLocalizedFormatKey
我尝试使用 Localizable.stringsdict 在 swift 应用程序中处理复数形式。 到目前为止一切正常,但大数字没有千位分隔符。有没有办法得到这样的结果: 1 new Contine
正如标题所说。我正在使用 Xcode 8.3,当我导出 .xliff 时,它不包括 localizable.stringsdict 中的内容。我选择了 localizable.stringsdict
有人知道如何在 Xcode 中创建 .stringsdict 文件吗?当我使用 Finder 将一个单独的 .stringsdict 文件拖到 ./en.lproj 目录时,项目导航器中没有看到它。
我是一名优秀的程序员,十分优秀!