The task is to load the corresponding background image on the view, depending on the localization language selected. That is, in -viewDidLoad controller you need to issue a scheme

if (выбран русский) { [self setBackgroundImage: [UIImage imageWithImage:@"ru.png"]]; } else if (выбран английский) { [self setBackgroundImage: [UIImage imageWithImage:@"en.png"]]; } 

That is how to find out the meaning of the chosen language?

  • one
    [Article on application localization] [1]. [1]: - Niki-Timofe
  • The article is nothing on the localization of images. Apple generally does not recommend doing so by writing all the text programmatically, but in my case there will be a ready-made design and the application will not be released as app. - AlexThumb

2 answers 2

Your option is good, but I did it a little differently, although this was not about languages, but color schemes.

The essence of this.

Add a category to a UIImage

 @interface UIImage (LocalizedImage) + (UIImage *)localizedImageWithName:(NSString *)aName; @end @implementation UIImage (LocalizedImage) + (UIImage *)localizedImageWithName:(NSString *)aName { NSString *localeId = [[NSLocale currentLocale] localeIdentifier]; return [UIImage imageNamed:[NSString stringWithFormat:@"% @_ %@.png", aName, localeId]]; } @end 

Now all you have to do is have the images in the bundle named appropriately, for example:

 background_en.png background_ru.png 

ZY Could be mistaken in syntax, I write from memory.

  • I understand that before that you need to add the necessary languages ​​to the localized.strings project? - AlexThumb
  • one
    No, the lines are for strings. Just substitute the right pictures and that's it. - AlexDenisov 8:49
  • Thank you very much, I will be implementing! - AlexThumb

So it’s possible to just localize the picture itself in Xcode and the program will automatically download the desired picture depending on the language.

  • and how to localize it? - AlexDenisov