xcode - load localized images with the same name,

2019-02-16 00:05发布

问题:

I'm trying to load a "Play" image(uiimageview) depending on the device language.

In my AppBundle there are to folders, en.lproj(english) and es.lproj(spanish) with a Play.png image each one(one in english and one in spanish).

I know how to load localized images using a Localizable.strings and images with different name, for example, Play_en.png and Play_es.png... using NSLocalizedString or something like that.

But, is there any way to load that localized image with the same name? (primarily to maintain a good organization)

This is how looks in xcode: http://a.imageshack.us/img51/8999/1007230001.png

Thank you for reading ;)

回答1:

What I do is create my localizable directories (en.lproj, fr_FR.lproj, etc) then I will drag all the localizable images into their respective directories, then add all the new images to the Xcode project. Xcode is smart enough to realize that the same image name exists in multiple .lproj directories



回答2:

What i am doing is in different folders (en.lproj, es.lproj) , i put different images with same name and it automatically detects the image depends on the language you have chosen. It works for me.