Localize on iOS

The Smart Display SDK provides a convenient way to add languages or modify the strings used when displaying the ads.

  1. Supported languages
  2. Adding / changing localization
  3. Strings keys

Supported languages

By default, the SDK is shipped with the following languages:

  • English
  • French

Adding / changing localization

  • Create a SASDisplayKit.strings file in your application project.
  • Add this new file to your app's target.

    This will add your string file to your application main bundle.

  • Edit the strings you want to change.

    You can refer to the string keys table for description and identifier of each supported string.

  • Tell the SDK about your string file.

    You can pass your prefered string bundle to the SASConfiguration shared instance.
    By default, the SASDisplayKit.framework bundle will be used, but if you specify another bundle, the SDK will look into this bundle to find the strings and fallback on its own bundle if nothing is found in yours.

    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    	// ...
    
    	// Indicates to the SDK in which bundle to look first for the SASDisplayKit.strings file.
    	// If the requested key for a string is not found in specified bundle,
    	// the SDK will fallback on its own bundle.
    	SASConfiguration.shared.stringsBundle = Bundle.main
    
    	// ...
    }
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    	// ...
    
    	// Indicates to the SDK in which bundle to look first for the SASDisplayKit.strings file.
    	// If the requested key for a string is not found in specified bundle,
    	// the SDK will fallback on its own bundle.
    	[[SASConfiguration sharedInstance] setStringsBundle:[NSBundle mainBundle]];
    
    	// ...
    }
    

Localized strings

Here is the exhaustive list of the keys used to localized strings in the SASDisplayKit.strings resource file.


Key Description
• Native video player interface
sasdisplaykit.strings.ui.nativevideo.close_button_label 'Close' button label
sasdisplaykit.strings.ui.nativevideo.replay_button_label 'Replay' button label
sasdisplaykit.strings.ui.nativevideo.more_info_button_label 'More Info' button label
sasdisplaykit.strings.ui.nativevideo.download_button_label 'Install Now' button label
sasdisplaykit.strings.ui.nativevideo.watch_button_label 'Watch More' button label
• URL errors
sasdisplaykit.strings.errors.url.cannot_open_alert_title Title of the alert view displayed when an URL cannot be open
sasdisplaykit.strings.errors.url.cannot_open_alert_message Message of the alert view displayed when an URL cannot be open
sasdisplaykit.strings.errors.url.cannot_open_alert_button Button label of the alert view displayed when an URL cannot be open