Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS localized images not showing up

I am localizing an app and while the process seems straight forward (I followed http://www.raywenderlich.com/2876/localization-tutorial-for-ios with minor adjustments for new Xcode interface), and worked for strings with no issues, I cannot get my localized images to show up.

In Xcode, I already have a set of images in the original language and clicked the "Localize..." button for each of them. Accepted the default selection of "English" and noted that all the images were moved into a new "en.lproj" folder. All these images are used by calling [UIImage imageNamed:@"image1"] within the code.

Then I collected all my localized, French versions of these images and placed them into a folder "fr.lproj" at the same level as the "en.lproj" Xcode created. File -> Add Files to "Project" and point it to that folder. At this point Xcode actually automatically detected that these are French localized files and the right side bar correctly identifies them as such when I select any of those files. Project info tab correctly shows the expected number of localized files for each language. Yet when I run the app with French language selected in the simulator, it shows me localized French text, but English versions of images.

Am I missing any steps that should have been performed, or should something be done differently?

like image 572
SaltyNuts Avatar asked Nov 22 '13 21:11

SaltyNuts


1 Answers

This happens often due to caching. Make sure to

A) delete the app from the simulator. You can also "Reset content and settings" on the simulator, but that shouldn't normally be needed

B) run Project > Clean

Sometimes it is also necessary to

C) run Project > Clean Build Folder (use Ctrl key)

D) delete the Derived Data from your project. To do this, open Organizer and choose your Project. Sometimes you even have to do this manually, i.e. navigate in finder to the folder and delete all files and folders.

Usually, this should do it. Sometimes a little trick works as well to quickly refresh index and cache, especially precompiled headers - open the .pch file in your project, and "break" it (e.g. comment out a line) so that it fails to compile. This will trigger headers to recompile as well.

Hope this helps.

like image 56
user1459524 Avatar answered Oct 07 '22 02:10

user1459524