swiftlocalizationlocalizable.strings

Xcode cannot find my Localizable.stringsdict file


I am trying to add pluralizable localization to my Xcode project, using Xcode 11.2.1

I followed the steps in this tutorial: https://medium.com/@vitaliikuznetsov/plurals-localization-using-stringsdict-in-ios-a910aab8c28c , which is a pretty basic instruction on how these things work. Mine, however, did not work, SO, I tried the following:

0) Actually running the tutorial code to make sure it works on my copy of Xcode. It does.

1) Copying the example Localizable.stringsdict from the tutorial into my program, and using the keys from said tutorial in my calls, in case I had made a bad Localizable.stringsdict or was calling it wrong. This failed.

2) Creating the Localizable.stringsdict as a property list, as some older questions suggested, instead of a Stringsdict file when creating it new, and copying the known 'good xml' of the example plist into it. This failed.

3) I tried removing all localized content from the project, and re-adding the strings file and the stringsdict file. Now it can't find either of them.

Clearly I must be missing some configuration, some step, some way of saying HEY XCODE LOCALIZE THESE. When I look at the 'Localizations' tab in the Project, there is only 1 file localized, for "Base"


Solution

  • Number 4 was the clue here. My project has a lot of targets. Add your stringsdict file to the targets it needs to be added to. Derp. I added the dict file to the proper target and everything works fine.

    Always check the obvious stuff first.