Update 4/10/2017: updated script working with Cocoapod 1.3.1
... If you are using CocoaPods, you may want to remove unwanted localizations using the pre install script below. Modify the supported_locales array to match your supported locales and paste it into your Podfile.
Note the all lowercase
platform :ios, '9.0'
target 'MyApp-iOS' do
use_frameworks!
# Pods for MyApp-iOS
# Remove unused languages from Pods
pre_install do |installer|
supported_locales = ['base', 'en', 'english']
delete_unsupported_locales(installer.sandbox.root, supported_locales)
end
end
def delete_unsupported_locales(root, supported_locales)
Dir.glob(File.join(root, '**', '*.lproj')).each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end