iOS localized images not showing up
Asked Answered
O

2

5

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?

Overlap answered 22/11, 2013 at 21:11 Comment(0)
P
8

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.

Pains answered 22/11, 2013 at 23:28 Comment(0)
M
0

enter image description here

Image localization doesn't worked correctly for me when there are 2(or more) PREFERRED LANGUAGE ORDER in the simulator Settings.

I'm new to iOS localization so.. I don't know why it is working like that. Anyways try to maintain only 1 PREFERRED LANGUAGE ORDER to resolve the issue.

Martellato answered 8/4, 2020 at 15:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.