Difference between revisions of "WID/Current/Developer/GWCInternat"

From Genesys Documentation
Jump to: navigation, search
(Published)
(Published)
Line 2: Line 2:
 
|Standalone=No
 
|Standalone=No
 
|DisplayName=Localize widgets and services
 
|DisplayName=Localize widgets and services
|Role=Developer
+
|Platform=PureEngage
 
|TocName=Localize widgets and services
 
|TocName=Localize widgets and services
|Platform=PureEngage
 
 
|ComingSoon=No
 
|ComingSoon=No
 
|Context=Localize your Genesys Widgets user messages and prompts by creating and hosting a Language Pack that Genesys Widgets can access.
 
|Context=Localize your Genesys Widgets user messages and prompts by creating and hosting a Language Pack that Genesys Widgets can access.
Line 10: Line 9:
 
|Type=Structured
 
|Type=Structured
 
|alignment=Vertical
 
|alignment=Vertical
 +
|gif=No
 
|structuredtext=The Language Pack is a special file written in JSON format.
 
|structuredtext=The Language Pack is a special file written in JSON format.
  
Line 54: Line 54:
 
</script>
 
</script>
 
</source>
 
</source>
 
+
|fullwidth=No
 
 
|advanced=No
 
 
|Status=No
 
|Status=No
}}
+
}}{{Section
{{Section
+
|sectionHeading=Master Localization File
 
|Type=Structured
 
|Type=Structured
|sectionHeading=Master Localization File
 
 
|anchor=mtlp
 
|anchor=mtlp
 
|alignment=Vertical
 
|alignment=Vertical
|structuredtext=
+
|gif=No
 
+
|structuredtext={{#Widget:ExtLink|link=https://apps.mypurecloud.com/widgets/9.0/i18n/widgets-en.i18n.json
{{#Widget:ExtLink|link=https://apps.mypurecloud.com/widgets/9.0/i18n/widgets-en.i18n.json
 
 
|displaytext=This URL}}  provides the latest i18n localization content containing all the language codes and strings of all Widgets. This acts as a centralized master file that you can use as a reference to create your own modified localization file and host it. In this way, you can use this to override the language content.  
 
|displaytext=This URL}}  provides the latest i18n localization content containing all the language codes and strings of all Widgets. This acts as a centralized master file that you can use as a reference to create your own modified localization file and host it. In this way, you can use this to override the language content.  
  
 
{{NoteFormat|The English language pack file provided in the above URL is just for reference. Do not load this file into Widgets because it is already built into Widgets by default.}}
 
{{NoteFormat|The English language pack file provided in the above URL is just for reference. Do not load this file into Widgets because it is already built into Widgets by default.}}
 
+
|fullwidth=No
 
 
 
 
 
 
|advanced=No
 
 
|Status=No
 
|Status=No
}}
+
}}{{Section
{{Section
+
|sectionHeading=Multiple Translated Language Packs
 
|Type=Structured
 
|Type=Structured
|sectionHeading=Multiple Translated Language Packs
 
 
|anchor=mtlp
 
|anchor=mtlp
 
|alignment=Vertical
 
|alignment=Vertical
|structuredtext=
+
|gif=No
Multiple i18n language pack files are available as individual JSON files in the /i18n folder. You can select the desired language pack file and then set the <tt>i18n</tt> and <tt>lang</tt> properties in the '''window._genesys.widgets.main''' configuration option. Each language pack file is named using the language code to identify easily. The same language code is also used inside the language pack file to construct the i18n JSON. This language code must be specified in the '''main.lang''' configuration option.
+
|structuredtext=Multiple i18n language pack files are available as individual JSON files in the /i18n folder. You can select the desired language pack file and then set the <tt>i18n</tt> and <tt>lang</tt> properties in the '''window._genesys.widgets.main''' configuration option. Each language pack file is named using the language code to identify easily. The same language code is also used inside the language pack file to construct the i18n JSON. This language code must be specified in the '''main.lang''' configuration option.
  
 
Example:
 
Example:
Line 112: Line 103:
 
!{{!}}Language
 
!{{!}}Language
 
!{{!}}Code
 
!{{!}}Code
 +
{{!}}-
 +
{{!}}{{!}}Brazilian Portuguese
 +
{{!}}{{!}}pt-BR
 +
{{!}}-
 +
{{!}}{{!}}Chinese Simplified
 +
{{!}}{{!}}zh-CN
 +
{{!}}-
 +
{{!}}{{!}}Chinese Traditional
 +
{{!}}{{!}}zh-TW
 
{{!}}-
 
{{!}}-
 
{{!}}{{!}}Danish
 
{{!}}{{!}}Danish
 
{{!}}{{!}}da
 
{{!}}{{!}}da
 
{{!}}-
 
{{!}}-
{{!}}{{!}}German
+
{{!}}{{!}}Dutch
{{!}}{{!}}de
+
{{!}}{{!}}nl
 
{{!}}-
 
{{!}}-
 
{{!}}{{!}}English
 
{{!}}{{!}}English
 
{{!}}{{!}}en
 
{{!}}{{!}}en
{{!}}-
 
{{!}}{{!}}Spanish
 
{{!}}{{!}}es
 
 
{{!}}-
 
{{!}}-
 
{{!}}{{!}}Finnish
 
{{!}}{{!}}Finnish
Line 130: Line 127:
 
{{!}}{{!}}French
 
{{!}}{{!}}French
 
{{!}}{{!}}fr
 
{{!}}{{!}}fr
 +
{{!}}-
 +
{{!}}{{!}}German
 +
{{!}}{{!}}de
 
{{!}}-
 
{{!}}-
 
{{!}}{{!}}Italian
 
{{!}}{{!}}Italian
Line 146: Line 146:
 
{{!}}{{!}}pl
 
{{!}}{{!}}pl
 
{{!}}-
 
{{!}}-
{{!}}{{!}}Brazilian Portuguese
+
{{!}}{{!}}Spanish
{{!}}{{!}}pt-BR
+
{{!}}{{!}}es
 
{{!}}-
 
{{!}}-
 
{{!}}{{!}}Swedish
 
{{!}}{{!}}Swedish
Line 157: Line 157:
 
{{!}}{{!}}Turkish
 
{{!}}{{!}}Turkish
 
{{!}}{{!}}tr
 
{{!}}{{!}}tr
{{!}}-
 
{{!}}{{!}}Chinese Simplified
 
{{!}}{{!}}zh-CN
 
{{!}}-
 
{{!}}{{!}}Chinese Traditional
 
{{!}}{{!}}zh-TW
 
{{!}}-
 
{{!}}-
 
{{!}}{{!}}Dutch
 
{{!}}{{!}}nl
 
 
{{!}}}
 
{{!}}}
 
+
|fullwidth=No
|advanced=No
 
 
|Status=No
 
|Status=No
}}
+
}}{{Section
{{Section
+
|sectionHeading=Configuration Options
 
|Type=Structured
 
|Type=Structured
|sectionHeading=Configuration Options
 
 
|alignment=Vertical
 
|alignment=Vertical
 +
|gif=No
 
|structuredtext='''main.lang'''<br />'''Type''': string<br />'''Default''': "en"<br />'''Requirement''': Optional<br />'''Description''': A language code to specify which language to display in the Widgets. Language codes are set by the customer.
 
|structuredtext='''main.lang'''<br />'''Type''': string<br />'''Default''': "en"<br />'''Requirement''': Optional<br />'''Description''': A language code to specify which language to display in the Widgets. Language codes are set by the customer.
  
Line 181: Line 170:
  
 
'''main.i18n (inline object)'''<br />'''Type''': object<br />'''Default''': built-in English words and phrases<br />'''Requirement''': Optional<br />'''Description''': An inline JSON object. Can be partial or complete. Unspecified strings will use default values.
 
'''main.i18n (inline object)'''<br />'''Type''': object<br />'''Default''': built-in English words and phrases<br />'''Requirement''': Optional<br />'''Description''': An inline JSON object. Can be partial or complete. Unspecified strings will use default values.
|advanced=No
+
|fullwidth=No
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
 +
|sectionHeading=Language Pack JSON Format
 
|Type=Structured
 
|Type=Structured
|sectionHeading=Language Pack JSON Format
 
 
|alignment=Vertical
 
|alignment=Vertical
 +
|gif=No
 
|structuredtext=The Language Pack is written in JSON format.
 
|structuredtext=The Language Pack is written in JSON format.
  
Line 222: Line 212:
 
}
 
}
 
</source>
 
</source>
|advanced=No
+
|fullwidth=No
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
 +
|sectionHeading=Localization Namespaces
 
|Type=Structured
 
|Type=Structured
|sectionHeading=Localization Namespaces
 
 
|alignment=Vertical
 
|alignment=Vertical
 +
|gif=No
 
|structuredtext={{{!}} class="wikitable" style="width: auto;"
 
|structuredtext={{{!}} class="wikitable" style="width: auto;"
 
{{!}}-
 
{{!}}-
Line 233: Line 224:
 
!{{!}}Namespace
 
!{{!}}Namespace
 
{{!}}-
 
{{!}}-
{{!}}{{!}}WebChat
+
{{!}}{{!}}Calendar
{{!}}{{!}}webchat
+
{{!}}{{!}}calendar
 
{{!}}-
 
{{!}}-
{{!}}{{!}}SendMessage
+
{{!}}{{!}}CallBack
{{!}}{{!}}sendmessage
+
{{!}}{{!}}callback
 
{{!}}-
 
{{!}}-
 
{{!}}{{!}}CallUs
 
{{!}}{{!}}CallUs
Line 244: Line 235:
 
{{!}}{{!}}ChannelSelector
 
{{!}}{{!}}ChannelSelector
 
{{!}}{{!}}channelselector
 
{{!}}{{!}}channelselector
{{!}}-
 
{{!}}{{!}}CallBack
 
{{!}}{{!}}callback
 
 
{{!}}-
 
{{!}}-
 
{{!}}{{!}}KnowledgeCenter
 
{{!}}{{!}}KnowledgeCenter
Line 254: Line 242:
 
{{!}}{{!}}offers
 
{{!}}{{!}}offers
 
{{!}}-
 
{{!}}-
{{!}}{{!}}Calendar
+
{{!}}{{!}}SendMessage
{{!}}{{!}}calendar
+
{{!}}{{!}}sendmessage
 +
{{!}}-
 +
{{!}}{{!}}WebChat
 +
{{!}}{{!}}webchat
 
{{!}}}
 
{{!}}}
|advanced=No
+
|fullwidth=No
 
|Status=No
 
|Status=No
}}
+
}}{{Section
{{Section
+
|sectionHeading=Language Codes
 
|Type=Structured
 
|Type=Structured
|sectionHeading=Language Codes
 
 
|alignment=Vertical
 
|alignment=Vertical
 +
|gif=No
 
|structuredtext=To allow flexibility in the way your website handles multiple languages and language codes, there are no rules for language codes other than that they must be strings. This means that you can use any language code system.
 
|structuredtext=To allow flexibility in the way your website handles multiple languages and language codes, there are no rules for language codes other than that they must be strings. This means that you can use any language code system.
  
Line 269: Line 260:
  
 
{{NoteFormat|When using one of the available pre-translated language packs, ensure the language code maps with the one included in the language pack file.}}
 
{{NoteFormat|When using one of the available pre-translated language packs, ensure the language code maps with the one included in the language pack file.}}
|advanced=No
+
|fullwidth=No
 
|Status=No
 
|Status=No
}}
+
}}{{Section
{{Section
+
|sectionHeading=Plugin Localization Options
 
|Type=Structured
 
|Type=Structured
|sectionHeading=Plugin Localization Options
 
 
|alignment=Vertical
 
|alignment=Vertical
|structuredtext=* {{Link-SomewhereInThisVersion|manual=SDK|topic=WebChat-combined|anchor=localize|display text=WebChat}}
+
|gif=No
* {{Link-SomewhereInThisVersion|manual=SDK|topic=WebChatService-combined|anchor=localize|display text=WebChatService}}
+
|structuredtext=*{{Link-SomewhereInThisVersion|manual=SDK|topic=ChannelSelector-combined|anchor=localize|display text=ChannelSelector}}
* {{Link-SomewhereInThisVersion|manual=SDK|topic=Co-browse-combined|anchor=localize|display text=Co-browse}}
+
*{{Link-SomewhereInThisVersion|manual=SDK|topic=CallUs-combined|anchor=localize|display text=CallUs}}
 +
*{{Link-SomewhereInThisVersion|manual=SDK|topic=Calendar-combined|anchor=localize|display text=Calendar}}
 +
*{{Link-SomewhereInThisVersion|manual=SDK|topic=Callback-combined|anchor=localize|display text=Callback}}
 +
*{{Link-SomewhereInThisVersion|manual=SDK|topic=Co-browse-combined|anchor=localize|display text=Co-browse}}
 +
*{{Link-SomewhereInThisVersion|manual=SDK|topic=SideBar-combined|anchor=localize|display text=SideBar}}
 +
*{{Link-SomewhereInThisVersion|manual=SDK|topic=WebChat-combined|anchor=localize|display text=WebChat}}
 
<!--*<a href="GWELocalization" data-mce-href="GWELocalization" title="GWELocalization (Page GWELocalization could not be found on this wiki)" data-mw-type="internal_link" class="link internal mw-internal-link mceNonEditable new" data-mw-wikitext="%5B%5BGWELocalization%7CGWE%20Localization%5D%5D" contenteditable= "false" ></a>-->
 
<!--*<a href="GWELocalization" data-mce-href="GWELocalization" title="GWELocalization (Page GWELocalization could not be found on this wiki)" data-mw-type="internal_link" class="link internal mw-internal-link mceNonEditable new" data-mw-wikitext="%5B%5BGWELocalization%7CGWE%20Localization%5D%5D" contenteditable= "false" ></a>-->
|advanced=No
+
|fullwidth=No
 
|Status=No
 
|Status=No
 
}}
 
}}
 +
|Role=Developer
 
}}
 
}}

Revision as of 14:42, December 5, 2019

This topic is part of the manual Widgets Developer's Guide for version Current of Widgets.

Localize your Genesys Widgets user messages and prompts by creating and hosting a Language Pack that Genesys Widgets can access.

Related documentation:

The Language Pack is a special file written in JSON format.

You also have to specify your Language Pack file in the window_genesys.widgets.main section of your Genesys Widgets configuration options, as shown in this example:

<script>

    if(!window._genesys)window._genesys = {};
    if(!window._gt)window._gt = [];

    window._genesys.widgets = {

        main: {

            theme: "dark",
            lang: "en",

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

            // OR define the JSON object inline
            i18n: {

                "en": {

                    "webchat": {

                        "ChatStarted": "Chat Started",
                        "ChatEnded": "Chat Ended",
                        ...
                    },

                    "sendmessage": {

			"EmailFormFirstname": "First Name",
			"EmailFormLastname": "Last Name",
                         ...
                     }
                }
            }
        }
    };
</script>

Master Localization File

This URL provides the latest i18n localization content containing all the language codes and strings of all Widgets. This acts as a centralized master file that you can use as a reference to create your own modified localization file and host it. In this way, you can use this to override the language content.

Important
The English language pack file provided in the above URL is just for reference. Do not load this file into Widgets because it is already built into Widgets by default.

Multiple Translated Language Packs

Multiple i18n language pack files are available as individual JSON files in the /i18n folder. You can select the desired language pack file and then set the i18n and lang properties in the window._genesys.widgets.main configuration option. Each language pack file is named using the language code to identify easily. The same language code is also used inside the language pack file to construct the i18n JSON. This language code must be specified in the main.lang configuration option.

Example:

The French language pack file is available as widgets-fr.i18n.json. To use this language pack file, follow the example below.

 window._genesys.widgets = {

     main: {

         lang: "fr",
         i18n: "/relative/path/to/i18n/widgets-fr.i18n.json"

         // OR using the CDN URL
         i18n: "https://apps.mypurecloud.com/widgets/<version>/i18n/widgets-fr.i18n.json"
     }
 };


Language code mapping

Language Code
Brazilian Portuguese pt-BR
Chinese Simplified zh-CN
Chinese Traditional zh-TW
Danish da
Dutch nl
English en
Finnish fi
French fr
German de
Italian it
Japanese ja
Korean ko
Norwegian no
Polish pl
Spanish es
Swedish sv
Thai th
Turkish tr

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.Can be partial or complete. Unspecified strings will use default values.

main.i18n (inline object)
Type: object
Default: built-in English words and phrases
Requirement: Optional
Description: An inline JSON object. Can be partial or complete. Unspecified strings will use default values.

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.",

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

        "sendmessage": {

              // Localized strings
	     "SendMessageButton": "Send Message",
	     "EmailFormFirstname": "First Name",
	     "EmailFormLastname": "Last Name",

             //Errors
             "ErrorServerNotAvailable": "Unable to reach server. Please try again.",
	     "ErrorAttachfileSizeMax": "Total size of attachments exceeds limit: "
        }
    }
}

Localization Namespaces

Plugin Namespace
Calendar calendar
CallBack callback
CallUs callus
ChannelSelector channelselector
KnowledgeCenter knowledgecenter
Offers offers
SendMessage sendmessage
WebChat webchat

Language Codes

To allow flexibility in the way your website handles multiple languages and language codes, there are no rules for language codes other than that they must be strings. This means that you can use any language code system.

However, the language code that you set in window._genesys.widgets.main.lang must correspond to a language code in the Language Pack File.

Important
When using one of the available pre-translated language packs, ensure the language code maps with the one included in the language pack file.

Plugin Localization Options

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