Difference between revisions of "WID/Current/Developer/GWCInternat"
(Published) |
(Published) |
||
(12 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
|Standalone=No | |Standalone=No | ||
|DisplayName=Localize widgets and services | |DisplayName=Localize widgets and services | ||
− | |||
|TocName=Localize widgets and services | |TocName=Localize widgets and services | ||
− | | | + | |Context=Localize your Genesys Widgets user messages and prompts by creating and hosting a Language Pack that Genesys Widgets can access. |
|ComingSoon=No | |ComingSoon=No | ||
− | | | + | |Platform=GenesysEngage-cloud |
+ | |Role=Developer | ||
|Section={{Section | |Section={{Section | ||
− | |||
|alignment=Vertical | |alignment=Vertical | ||
|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 53: | ||
</script> | </script> | ||
</source> | </source> | ||
− | |||
|Status=No | |Status=No | ||
− | }} | + | }}{{Section |
− | {{ | + | |sectionHeading=Master localization file |
− | | | + | |anchor=mlf |
− | |sectionHeading=Multiple | + | |alignment=Vertical |
+ | |structuredtext=The [https://apps.mypurecloud.com/widgets/9.0/i18n/widgets-en.i18n.json widgets-en.i18n.json] file 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.}} | ||
+ | |Status=No | ||
+ | }}{{Section | ||
+ | |sectionHeading=Multiple translated language packs | ||
|anchor=mtlp | |anchor=mtlp | ||
|alignment=Vertical | |alignment=Vertical | ||
− | |structuredtext= | + | |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. |
− | 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. | ||
− | |||
− | |||
− | The French language pack file is available as '''widgets-fr.i18n.json'''. To use this language pack file, follow | + | ===Example=== |
+ | The French language pack file is available as '''widgets-fr.i18n.json'''. To use this language pack file, follow this example: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
Line 86: | Line 88: | ||
− | '''Language code mapping''' | + | '''Language code mapping examples:''' |
{{{!}} class="wikitable" style="width: auto;" | {{{!}} class="wikitable" style="width: auto;" | ||
Line 92: | Line 94: | ||
!{{!}}Language | !{{!}}Language | ||
!{{!}}Code | !{{!}}Code | ||
+ | {{!}}- | ||
+ | {{!}}{{!}}Brazilian Portuguese | ||
+ | {{!}}{{!}}pt-BR | ||
+ | {{!}}- | ||
+ | {{!}}{{!}}Chinese Simplified | ||
+ | {{!}}{{!}}zh-CN | ||
+ | {{!}}- | ||
+ | {{!}}{{!}}Chinese Traditional | ||
+ | {{!}}{{!}}zh-TW | ||
{{!}}- | {{!}}- | ||
{{!}}{{!}}Danish | {{!}}{{!}}Danish | ||
{{!}}{{!}}da | {{!}}{{!}}da | ||
{{!}}- | {{!}}- | ||
− | {{!}}{{!}} | + | {{!}}{{!}}Dutch |
− | {{!}}{{!}} | + | {{!}}{{!}}nl |
{{!}}- | {{!}}- | ||
{{!}}{{!}}English | {{!}}{{!}}English | ||
{{!}}{{!}}en | {{!}}{{!}}en | ||
− | |||
− | |||
− | |||
{{!}}- | {{!}}- | ||
{{!}}{{!}}Finnish | {{!}}{{!}}Finnish | ||
Line 110: | Line 118: | ||
{{!}}{{!}}French | {{!}}{{!}}French | ||
{{!}}{{!}}fr | {{!}}{{!}}fr | ||
+ | {{!}}- | ||
+ | {{!}}{{!}}German | ||
+ | {{!}}{{!}}de | ||
{{!}}- | {{!}}- | ||
{{!}}{{!}}Italian | {{!}}{{!}}Italian | ||
Line 126: | Line 137: | ||
{{!}}{{!}}pl | {{!}}{{!}}pl | ||
{{!}}- | {{!}}- | ||
− | {{!}}{{!}} | + | {{!}}{{!}}Spanish |
− | {{!}}{{!}} | + | {{!}}{{!}}es |
{{!}}- | {{!}}- | ||
{{!}}{{!}}Swedish | {{!}}{{!}}Swedish | ||
Line 137: | Line 148: | ||
{{!}}{{!}}Turkish | {{!}}{{!}}Turkish | ||
{{!}}{{!}}tr | {{!}}{{!}}tr | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{!}}} | {{!}}} | ||
− | | | + | {{NoteFormat|You may use any language code you wish. The above table is for reference only.|}} |
|Status=No | |Status=No | ||
− | }} | + | }}{{Section |
− | {{Section | + | |sectionHeading=Configuration options |
− | | | + | |anchor=config |
− | | | ||
|alignment=Vertical | |alignment=Vertical | ||
|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. | ||
− | '''main.i18n (external file)'''<br />'''Type''': string<br />'''Default''': built-in English words and phrases<br />'''Requirement''': | + | '''main.i18n (external file)'''<br />'''Type''': string<br />'''Default''': built-in English words and phrases<br />'''Requirement''': Required when using main.lang option.<br />'''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)'''<br />'''Type''': object<br />'''Default''': built-in English words and phrases<br />'''Requirement''': | + | '''main.i18n (inline object)'''<br />'''Type''': object<br />'''Default''': built-in English words and phrases<br />'''Requirement''': Required when using main.lang option.<br />'''Description''': An inline JSON object. Can be partial or complete. Unspecified strings will use default values. |
− | |||
|Status=No | |Status=No | ||
}}{{Section | }}{{Section | ||
− | | | + | |sectionHeading=Language pack JSON format |
− | | | + | |anchor=lpjf |
|alignment=Vertical | |alignment=Vertical | ||
− | |structuredtext=The | + | |structuredtext=The language pack is written in JSON format. |
<source lang="javascript"> | <source lang="javascript"> | ||
Line 197: | Line 200: | ||
} | } | ||
</source> | </source> | ||
− | |||
|Status=No | |Status=No | ||
}}{{Section | }}{{Section | ||
− | | | + | |sectionHeading=Localization namespaces |
− | | | + | |anchor=ln |
|alignment=Vertical | |alignment=Vertical | ||
|structuredtext={{{!}} class="wikitable" style="width: auto;" | |structuredtext={{{!}} class="wikitable" style="width: auto;" | ||
Line 208: | Line 210: | ||
!{{!}}Namespace | !{{!}}Namespace | ||
{{!}}- | {{!}}- | ||
− | {{!}}{{!}} | + | {{!}}{{!}}Calendar |
− | {{!}}{{!}} | + | {{!}}{{!}}calendar |
{{!}}- | {{!}}- | ||
− | {{!}}{{!}} | + | {{!}}{{!}}CallBack |
− | {{!}}{{!}} | + | {{!}}{{!}}callback |
{{!}}- | {{!}}- | ||
{{!}}{{!}}CallUs | {{!}}{{!}}CallUs | ||
Line 219: | Line 221: | ||
{{!}}{{!}}ChannelSelector | {{!}}{{!}}ChannelSelector | ||
{{!}}{{!}}channelselector | {{!}}{{!}}channelselector | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{!}}- | {{!}}- | ||
{{!}}{{!}}Offers | {{!}}{{!}}Offers | ||
{{!}}{{!}}offers | {{!}}{{!}}offers | ||
{{!}}- | {{!}}- | ||
− | {{!}}{{!}} | + | {{!}}{{!}}WebChat |
− | {{!}}{{!}} | + | {{!}}{{!}}webchat |
{{!}}} | {{!}}} | ||
− | |||
|Status=No | |Status=No | ||
− | }} | + | }}{{Section |
− | {{Section | + | |sectionHeading=Language codes |
− | | | + | |anchor=lc |
− | | | ||
|alignment=Vertical | |alignment=Vertical | ||
|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 244: | Line 238: | ||
{{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.}} | ||
− | |||
|Status=No | |Status=No | ||
− | }} | + | }}{{Section |
− | {{Section | + | |sectionHeading=Plugin localization options |
− | | | + | |anchor=plo |
− | | | ||
|alignment=Vertical | |alignment=Vertical | ||
− | |structuredtext=* {{Link-SomewhereInThisVersion|manual=SDK|topic= | + | |structuredtext=*{{Link-SomewhereInThisVersion|manual=SDK|topic=ChannelSelector-combined|anchor=localize|display text=ChannelSelector}} |
− | * {{Link-SomewhereInThisVersion|manual=SDK|topic= | + | *{{Link-SomewhereInThisVersion|manual=SDK|topic=CallUs-combined|anchor=localize|display text=CallUs}} |
− | * {{Link-SomewhereInThisVersion|manual=SDK|topic= | + | *{{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=SideBar-combined|anchor=localize|display text=SideBar}} |
+ | *{{Link-SomewhereInThisVersion|manual=SDK|topic=WebChat-combined|anchor=localize|display text=WebChat}} | ||
|Status=No | |Status=No | ||
}} | }} | ||
}} | }} |
Latest revision as of 20:56, February 3, 2021
Contents
Localize your Genesys Widgets user messages and prompts by creating and hosting a Language Pack that Genesys Widgets can access.
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
The widgets-en.i18n.json file 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.
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 this example:
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 examples:
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: Required when using main.lang option.
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: Required when using main.lang option.
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 |
Offers | offers |
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.