Yurkevich
Yurkevich

Reputation: 4517

My .stringsdict file doesn't affect the app

I am working on localization for plural rules. I created plural.stringsdict file and added to the project's target. I ticked the checkbox to localize the file on English. I also have localisable.strings file. Tried on iOS 7 and iOS 8.

Code:

NSString *caption = [NSString localizedStringWithFormat:NSLocalizedString(@"You gave %ld Piastre(s) to %@",@"Balance History"), (unsigned long)floor(aBalanceHistory.convertedAmount), aBalanceHistory.memberName];

File:

<?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>

The app displays not localized version. It always says "You gave x Piastre."

Upvotes: 3

Views: 316

Answers (1)

Yurkevich
Yurkevich

Reputation: 4517

I fixed the issue by naming my file exactly the same as .strings file — Localizable.strings.

Upvotes: 4

Related Questions