Multi-line strings in objective-c localized strings file
Just use the new lines directly. “email” = “Hello %@, Check out %@. Sincerely, %@”;
Just use the new lines directly. “email” = “Hello %@, Check out %@. Sincerely, %@”;
I assume you mean the Bundle Display Name that appears on the device’s home screen: You should create a localized file called InfoPlist.strings similar to the Localizable.strings file that you use for the usual text snippets. In the InfoPlist.strings you can localize the different keys from your Info.plist. To localize the app name add: “CFBundleDisplayName” … Read more
Apart from addressing question what language end-users will see, you need to consider also what will be shown in the AppStore. My current experience is that if you use Base for English, English won’t appear in list of supported languages (how Apple knows in which language your base localization is) in the description of your … Read more
[NSString stringWithFormat:NSLocalizedString(@”Is “%@“ still correct for “%@“ tap “OK“ otherwise tap “Change“ to choose new contact details”, @”Query if parm 1 is still correct for parm 2″), individual.contactInfo, individual.name];
In my case it was because I had mistakenly named the file “Localization.strings” and hadn’t noticed (it has to be named Localizable.strings). As explained previously the symptom is because the compiler cannot find the string. Otherwise the cause could be any number of things but usually it’s a missing semi colon or quotation mark. These … Read more
In iOS 6 there is a Project setting under the Info tab that says “Use Base Internationalization”. If you check the box, it will pull all of the strings out of the Storyboard and into internationalized .strings files. This way you don’t have to have multiple copies of the Storyboard.
If what you want is to return the localized version of “This is an Apple/Orange/whatever”, you’d want: NSString *localizedVersion = NSLocalizedString(([NSString stringWithFormat:@”This is an %@”, @”Apple”]), nil); (I.e., the nesting of NSLocalizedString() and [NSString stringWithFormat:] are reversed.) If what you want is the format to be localized, but not the substituted-in value, do this: NSString … Read more
You can use the sprintf format parameters within NSLocalizedString, so your example can look like this: let myString = String(format: NSLocalizedString(” – %d Notifica”, comment: “sottotitolo prescrizione per le notifiche al singolare”), count)
This is mentioned in the Xcode 6.1 Release Notes and in other stack overthrow threads, like: iOS8.1 Simulator always uses US keyboard layout despite german hardware keyboard
NSLocalizedString has a few limitations, but it is so central to Cocoa that it’s unreasonable to write custom code to handle localization, meaning you will have to use it. That said, a little tooling can help, here is how I proceed: Updating the strings file genstrings overwrites your string files, discarding all your previous translations. … Read more