iOS 9.0 provides new way to select and display proper localized string variation depending on screen width. With Swifternalization 1.2 you can use the feature also in iOS 8.0.
If you don’t know how the feature works in iOS 9 you can read about it in previous post iOS: Strings with length variations.
Today I’ve released Swifternalization 1.2 which has the strings length variations functionality but you can use it in iOS 8.0 too - The framework works with JSON files instead of Localizable.strings and avoids using stringdicts files.
Using the feature in a system manner you have to create stringsdict file for
you key and create a dictionary inside with key-value pairs and in the code you
have to call
variantFittingPresentationWidth: method to get a proper string variant.
And in the code:
Doing this with Swifternalization you just need to extend/add key-value translation pair in JSON file like below:
And somewhere in code just call localizedString method and fill one of default parameters.
Easy, isn’t it? :)