0
我正致力於複雜規則的本地化。我創建了plural.stringsdict
文件並添加到項目的目標中。我勾選複選框以本地化英文文件。我也有localisable.strings
文件。嘗試在iOS 7和iOS 8我的.stringsdict文件不會影響應用程序
代碼:
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>%#@[email protected]</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>
這個應用程序顯示未本地化版本。它總是說「你給了Piastre x。」