Multi-line strings in ObjC localization files

Posted by on Oct 11, 2010 in code | No Comments

I manage my email templates in localization files for ease of formatting. When first creating them, I found lots of documentation on creating single-line strings, but nothing on multiline strings. I could create a single-line string like this:

"my-email-template"="Dear %@,\n\nMessage here.\n\nSalutation,\n\nSender";

However, that will quickly get unruly with a real email template. It turns out that in a .strings file, you can break a value over multiple lines, and the line breaks are interpreted correctly. So the above template can be written as:

"my-email-template"="Dear %@,

Message here.

Salutation,

Sender";