iosswiftxcodelocalizationlocalizable.strings

Swift: Localization in Storyboard - Labels not added to Main.strings?


When I try to localize my app and I create a new Main.strings file for the target language, everything I have created in interface builder (labels, buttons, ...) is added to the new Main.strings files (base and language versions) and I can localize the text accordingly.

But when I later add a label or a button to a ViewController in interface builder, it is not automatically added to the Main.strings files for the base and language version.

So, how can I find out what the ObjectID for the button/label is so that I can add it to the strings files?

Or is there another way to force Xcode to add newly added labels and buttons to those files automatically?


Solution

  • After selecting UILabel from storyboard, You can find object id of UILabel in right panel:

    enter image description here

    Then you can set text of label as below in your Main.string file:

    "sxl-NO-5WX.text" = "Phone";