How can I localize a folder of images for iOS?

10,426

First of all, make sure you set the localizations in your project:

enter image description here

You should have *.lproj folders in your project folder. One for each localization (en.lproj, de.lproj etc). Add the localized images to the right folder. You shouldn't have to change the code, if you used the normal ways to load your images ([UIImage imageNamed:@xyz.png"]). iOS will simple load the correct one depending on the user's language settings.

You may have to create the localization folder in the directory where the original image existed in order to not have to change the paths of the resources. So if the path of your image is myfolder/myimage.png, then the en.lproj and fr.lproj folders would go in myfolder.

Share:
10,426
Sophie McCarrell
Author by

Sophie McCarrell

i dunno. Sweets?

Updated on June 08, 2022

Comments

  • Sophie McCarrell
    Sophie McCarrell almost 2 years

    I have a project that has already been heavily developed and all of a sudden we realized that we needed a set of images translated. I have the translated images, but I am unsure how to apply them to my project.

    What is the easiest way to implement localization on a number of images that are already referenced in a project?

    The images are referenced by object named. So @"xyz", rather than @"xyz.png". Also the images' locations are set to "Relative to Group", although I suppose I could change this, although I don't know what to.

    Thanks.

    [I've read the following, but it was unclear and get info doesn't have a localization option: localize many images in Xcode at once? ]

    EDIT: There are 74 images to be localized [for each of three languages] EDIT: added how the images are referenced.