By default, the languages of an app are set in info.plist
by using the values for the properties list key CFBundleLocalizations
. A definition as shown below should result in the supported languages English and German.
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>de</string>
</array>
But when looking at the AppStore, the languages shown there do not always correlated with this setting. The reason is that the languages shown on the AppStore are generated automatically based on the localized *.lproj
folders found in your app.
Normally those folders should be in sync with your properties list setting. But when you use third party libraries (e.g. with CocoaPods) additional localizations might be loaded into your app. In this case, all *.lproj
folders found in your app and in the pods are used for language determination.
How to correct the languages?
There is a plugin for that: cocoapods-prune-localizations, which can be simply added to your Podfile. When running pod install
, this script will remove all localized files from pods or just keep the specified languages. To install the script, run:
gem install cocoapods-prune-localizations
Then add the following lines to your Podfile:
plugin 'cocoapods-prune-localizations'
Localizations will be inferred from your project.
or if you would prefer to specify the localizations:
plugin 'cocoapods-prune-localizations', {:localizations => ["en", "es"]}
This will keep the English and Spanish localizations in the Pods. Modify the localizations to your needs.
Photo by Etienne Girardet on Unsplash
Leave a Reply