Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS is there a way to assign Localized String to a UILable from IB/storyboard

I want to assign NSLocalizedString(key, comment) to a UILabel from storyboard without creating an outlet for it.

like image 794
Nagesh Avatar asked Jun 29 '16 08:06

Nagesh


People also ask

How do I localize Xib files?

Right click on the xib file in Xcode, and choose Get Info . Select the General tab and on the bottom click Make File Localizable . Then you will be able to add localizations by clicking Add Localization on that same tab. I would recommend this tutorial for step-by-step information (and pretty pictures).

What is localized string key in SwiftUI?

The key used to look up an entry in a strings file or strings dictionary file.


1 Answers

Just select your storyboard/xib, go to File Inspector. In the Localization part, you can tick the language you want. Then, it will create a .string file with all text used in storyboard. You'll just have to provide a translation for each text used in storyboard.

If no language appear in this part, you have to change values of Localization native development region in Info of your project.

like image 129
AnthoPak Avatar answered Sep 28 '22 09:09

AnthoPak