Revision as of 19:38, May 3, 2018 by Tsnarski (talk | contribs)
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 strings containing @18n and replacing them with strings defined in your predefined localization JSON file. There are 2 things that you will need to set up to get everything working:

1) Pass in the appropriate @18n string to the open command 
2) Update your JSON internationalization files

Open Command Usage

There are 3 ways you can pass in a @18n string into the open command.

1) Fast and simple - '@i18n:title'

This way you don't have to specify the plugin name and the widgets framework will automatically check the Offers plugin JSON file for a string with appropriate name.

2) Proper way - '@i18n:offers.title'

Use the plugin name in the string to specify which plugin internationalization file to use. 

3) 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 :
_genesys.widgets.bus.command('Offers.open', {
	// 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',
	'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!