Revision as of 19:31, May 8, 2018 by Tsnarski (talk | contribs) (Example:)
Jump to: navigation, search

Localization

Important
Offers plugin is different from other plugins because all the strings displayed in the UI are not hard coded and passed in via the Open command. Thus you will have to learn how localization works under the hood to get it working with offers.

Offers Localization Overview

Localization works by looking for specific query strings containing "@18n:" and replacing them with strings defined in your localization JSON file. There are 2 things that you will need to set up to get everything working:

  • Pass in the appropriate @18n: querry strings to the open command
  • Update your JSON internationalization files

Open Command Usage

There are 2 ways you can pass in a @18n: querry string into the open command:

Default way:

'@i18n:offers.title'

Use the plugin name in the string to specify which plugin internationalization file to use.
Advanced and Flexible:

'@i18n:offers.offer1A.title'

The JSON file allows for multiple different nested definitions. This is extremely useful when trying to implement internationalization for multiple different offers.

Example:

You should not be using localization strings for the "Display Options" section of parameters.
The strings that need to be localized are under the Strings/Content section.
You can also localize the Call to Action URL (ctaURL) and the video URL (video), to link to proper localized content.


oMyPlugin.command('Offers.open', {
	// Display Options
	'mode':'overlay',
	'layout':'leftText',
	'downloadVideoLib' : true,
	'timeout' : 11000,
	'actionID':2,
	'media':'',

	// Strings/Content
	'title':'@i18n:title',
	'headline':'@i18n:headline',
	'body':'@i18n:body',
	'button':'@i18n:button',

        // URL strings
	'ctaURL':'@i18n:ctaURL',
	'video':'@i18n:video'
});

Example JSON definition

{
	"offers": {
		"title": "GenericTitle",
		"headline": "headline",
		"body": "GenericBody",
		"button": "GenericButton",
		"ctaURL": "GenericCtaURL",
		"offer1A": {
			"title": "title1A",
			"headline": "headline1A",
			"body": "body1A",
			"button": "button1A",
			"ctaURL": "ctaURL1A"
		},
		"offer1B": {
			"title": "title1B",
			"headline": "headline1B",
			"body": "body1B",
			"button": "button1B",
			"ctaURL": "ctaURL1B"
		}
	}
}
Comments or questions about this documentation? Contact us for support!