I'm trying to localize a small Xcode project (Xcode 9 and Swift 4). In that project there are places where I use plurals, so I need to localize them, too. To do that, I use stringsdict
file. In code I use localizedStringWithFormat(_:,fromat,:argument)
static method on a String
. Here how my code for a plural looks (I just print the words for testing):
let localizedString = NSLocalizedString("%d apple(s)", comment: "The number of apples")
print(String.localizedStringWithFormat(localizedString, 0))
print (String.localizedStringWithFormat(localizedString, 1))
print(String.localizedStringWithFormat(localizedString, 2))
print(String.localizedStringWithFormat(localizedString, 10))
Then I create a stringsdict
file. It looks like this:
In the video from WWDC 2017 (session 401) about Localization it is said, that when we use stringsdict
file for localizing plurals into other languages (in this case, I want to localize it into Russian) we just need to give values for the cases of our development language (English), and when exporting for localization, Xcode will automatically create cases in an XLIFF
file for the language into which we want to localize. So I've given values for zero, one and other (in the demo from the session values are given only to keys one and other, however, I don't thing that that's the reason of the problem).
Now, when I create an XLIFF
file it looks like this (only the part of apples):
As you can see, Xcode doesn't generate cases for a particular language automatically (for Russian it should have 4). I'm using stringsdict
files as well as trying to localize plurals for the first time, so I can't figure out what I'm doing wrong. If you know where is the issue, or have any suggestions, I would appreciate your help.