Revision as of 21:36, January 21, 2016 by Bfriend (talk | contribs) (Language Pack File Format)
Jump to: navigation, search

Localization

Genesys Widgets allow for localizing user messages and prompts. First, you must create and host a Language Pack that Genesys Widgets can access and use. The Language Pack is a file written in JSON format. Specify your Language Pack file by using Genesys Widgets configuration options, which are set in the window_genesys.cxwidget.main section.

<script>
	if (!window._genesys)
		window._genesys = {};

	window._genesys.cxwidget = {
		main: {
			theme: "dark",
			lang: "en",

                        // Enter a URL that points to 
			i18n: "http://HOST:PORT/path/to/lanaguages/file.json"

                        // OR define the JSON object inline
                        i18n: {
                                
                                "en": {
                                
                                        webchat: {

                                                "ChatStarted": "Chat Started",
                                                "ChatEnded": "Chat Ended",
                                                ...
                                        }
                                }
                        }
		}
	};
</script>

Configuration Options

main.lang

Type: string
Default: "en"
Requirement: Optional
Description: A language code to specify which language to display in the Widgets. Language codes are set by the customer.

main.i18n (external file)

Type: string
Default: built-in English words and phrases
Requirement: Optional
Description: A URL that the Widgets use to fetch the Language Pack file upon startup.

main.i18n (inline object)

Type: object
Default: built-in English words and phrases
Requirement: Optional
Description: A URL that the Widgets use to fetch the Language Pack file upon startup.

Language Pack JSON Format

The Language Pack is written in JSON format.

// Root
{	
	// Language Code
	"en": {

		// Widget name
		"webchat": {		

			// Localized strings
			"ChatStarted": "Chat Started",
			"ChatEnded": "Chat Ended",
			"ChatFailed": "There was a problem starting the chat session. Please Retry.",
			"ChatFailedRetry": "Retry",
			"ChatFailedClose": "Close",
			"UserNameDefault": "Anonymous",
			"AgentNameDefault": "Agent",
			"AgentConnected": "<%Agent%> Connected",
			"AgentDisconnected": "<%Agent%> Disconnected",
			"AgentTyping": "...",
			"AgentPending": "An Agent will be with you shortly",
			"AgentUnavailable": "Sorry. There are no agents available. Please try later",
			"ChatTitle": "Live Chat",
			"ChatEnd": "X",
			"ChatClose": "X",
			"ChatMinimize": "Min",
			"ChatFormFirstName": "First Name",
			"ChatFormLastName": "Last Name",
			"ChatFormNickname": "Nickname",
			"ChatFormEmail": "Email",
			"ChatFormSubject": "Subject",
			"ChatFormPlaceholderFirstName": "Optional",
			"ChatFormPlaceholderLastName": "Optional",
			"ChatFormPlaceholderNickname": "Optional",
			"ChatFormPlaceholderEmail": "Optional",
			"ChatFormPlaceholderSubject": "Optional",
			"ChatFormSubmit": "Start Chat",
			"ChatFormCancel": "Cancel",
			"ChatInputPlaceholder": "Type your message here and hit return",
			"ChatInputSend": "SEND",
			"ChatEndQuestion": "Are you sure you want to end this chat session?",
			"ChatEndCancel": "Cancel",
			"ChatEndConfirm": "End chat",
			"ActionsDownload": "Download transcript",
			"ActionsEmail": "Email transcript",
			"ActionsPrint": "Print transcript",
			"ActionsCobrowseStart": "Start Co-browse",
			"ActionsCobrowseStop": "Exit Co-browse",
			"ActionsVideo": "Invite to Video Chat",
			"InviteTitle": "Need help?",
			"InviteBody": "Let us know if we can help out.",
			"InviteReject": "No thanks",
			"InviteAccept": "Start chat",
			"EndConfirmBody": "Would you really like to end your chat session?",
			"EndConfirmAccept": "End chat",
			"EndConfirmReject": "Cancel",

			// Customer Defined Strings - Match & Replace messages received from chat server
			"SYS0001": "An Agent will be with you shortly"
		}
	}
}

Customer Defined Strings

Customers may define string key names and values to match system messages received from the chat server. If a customer system message is received as "SYS001" in the message body, Webchat will check if any keys match in the language pack and replace the message body accordingly. "SYS001" is an example format but there are no format restrictions on custom message keys. The purpose of this feature is to allow localization for the UI and Server to be kept in the same file.


Language Codes

To allow flexibility in the way your website currently handles multiple languages and language codes, there are no rules for language codes other than that they must be strings. You can use any language code system. Whatever language code you set in window._genesys.cxwidget.main.lang must correlate to a language code in the Language Pack File.

Special Values for Localization

You can inject the <%Agent%> special value. When used, the agent's name is rendered in its place at runtime.

Comments or questions about this documentation? Contact us for support!