Is it possible to localize strings directly in the iOS storyboard without using code?

I have a really simple start screen in a storyboard with UILabel and Button. No class files are needed yet and would like to avoid having two additional files just to install one UILabel in viewdidload.

Is there a way to set a shortcut directly in the storyboard? For example, select UILabel and write NSLocalizedString (@ "startlabel", nil) in the header tab?

Many thanks for your help

+4
source share
1 answer

You can create outputs for UILabel and UIButton , and then programmatically change the names:

 myLabel.text = NSLocalizedString(@"startlabel", "start label"); [myButton setTitle:NSLocalizedString(@"startButton", "start button") forState: UIControlStateNormal]; 

and do not forget to create Localizable.strings files where you can specify your translations

+3
source

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


All Articles