我正致力于多元化规则的本地化。我创建了plural.stringsdict
文件并添加到项目的目标中。我勾选了复选框以将文件本地化为英文。我也有localisable.strings
个文件。在iOS 7和iOS 8上尝试。
代码:
NSString *caption = [NSString localizedStringWithFormat:NSLocalizedString(@"You gave %ld Piastre(s) to %@",@"Balance History"), (unsigned long)floor(aBalanceHistory.convertedAmount), aBalanceHistory.memberName];
文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
plural.stringsdict
-->
<plist version="1.0">
<dict>
<key>You gave %ld Piastre to %@</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@Piastre@</string>
<key>Piastre</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>one</key>
<string>You gave %ld Piastre to %@</string>
<key>few</key>
<string>You gave %ld Piastres to %@</string>
<key>other</key>
<string>You gave %ld Piastres to %@</string>
</dict>
</dict>
</dict>
</plist>
该应用显示的不是本地化版本。它总是说&#34;你给了x Piastre。&#34;
答案 0 :(得分:3)
我通过将我的文件命名为.strings
文件 - Localizable.strings
完全相同来修复此问题。