Adding a new language to an existing localized application

I have an application that uses localization, I need to add another language, I want to display two different language images of the same name in one xib file, the xib file is not localized, since I localize the images. Can this be done using the interface constructor without writing any code?

+6
source share
3 answers

Add images to your localized subdirectories in your project (en.lproj, es.lproj, etc.), and iOS will pick the right image when it cancels the localized xib file.

Xcode can do this automatically: just select the resource you want to localize (image, xib file, etc.), display the File Inspector panel and click the Localize button.

(As a note, it is bad practice to localize a large number of images. You must remove text from the images and select them so that they are “neutral” and “understandable” in every region of the world. Thank you for that.)

+3
source

enter image description here

You can add another language by clicking on the + button. Hope this helps you. But you need to do some XIB, as you say, to install images in only one XIB, I think this is not possible.

+4
source

To do this without code, you must localize xibs, otherwise you will need code from you or other users and some configuration. It is easier:

Assuming that you have already added localization to the project (you can do this on the Project> Info tab), you just need to select the image in the project tree and check the necessary localizations in the right side panel (cmd-alt-1, localizations).

Replace the image in each * .lproj directory with the localized version. Then in viewDidLoad use -[UIImage imageNamed:] , as usual, to load the image into the xib image view or whatever you do.

0
source

Source: https://habr.com/ru/post/944275/


All Articles