Swift 4: Adding new UI Elements to the Main.strings file, which Xcode auto-generates for you

When you are ready to localize your App, Xcode will auto-generate a Main.strings file for your Main Storboard. In that file every element of the User Interface (labels & more) are listed in the following format:

/* Class = "UILabel"; text = "Subtitle"; ObjectID = "y5E-9n-LU8"; */
"y5E-9n-LU8.text" = "Untertitel";

That’s a pretty awesome format, as it makes localization quick and simple. However, if you add Elements after that file was generated you are left on your own. While an experienced Xcode user will find it easy, I had to go hunting for the Object ID and once you know, it’s a total “duh” moment.

You’ll find it in the Identity Inspector in the Document section. Told you it was a should have thought of that moment.

You then simply add your entries to the file and you are done:

"Mni-tS-rL6.normalTitle" = "Zurück";
"ryL-RR-chJ.normalTitle" = "Weiter";

Unlike myself, you probably want to add some useful comments there as well 😉

Swift 4: Adding new UI Elements to the Main.strings file, which Xcode auto-generates for you
Scroll to top