3

I'm implementing localization in my iOS application and I got stuck with plural forms.

I have two languages in my application.

When I've created Localizable.strings files they got language assigned to them so each file has one language.

Now when I created Localizable.stringsdict so I could handle plural forms it doesn't seem to be assigned to any language so I don't know how to handle different languages here.

Can anybody please help me understand this?

Edited: I'm not sure if I can provide any code that would help but let's say my Localizable.stringsdict file looks like this:

<?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>NumberOfMessages</key>
    <dict>
        <key>NSStringLocalizedFormatKey</key>
        <string>%#@value@</string>
        <key>value</key>
        <dict>
            <key>NSStringFormatSpecTypeKey</key>
            <string>NSStringPluralRuleType</string>
            <key>NSStringFormatValueTypeKey</key>
            <string>d</string>
            <key>one</key>
            <string>You have a new message.</string>
            <key>other</key>
            <string>You have %d new messages.</string>
        </dict>
    </dict>
</dict>
</plist>

Where should I put translations for another language?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253

1 Answers1

4

Select the file in the Xcode navigator and open the right-hand pane:

enter image description here

Click the "Localize..." button at the bottom to localize this file.

If you've localized things in this project before, there will be options to add it to each language in your project. If you haven't localized anything, go to the main projects settings and add Localizations:

enter image description here

When you localize files, copies will be put into the various *.lproj directories in your project.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610