Skip to content

Setting up language localization

edna-publisher edited this page Nov 29, 2023 · 26 revisions

Table of contents

Widget Language Localization

You can customize your labels and text to match the widget to your website localization. The package includes localization for all widget labels in the following languages: Russian (ru), English (en), Indonesian (id), Azerbaijani (az). They are included in the widget code. You can add any number of additional locales or override the settings of the existing ones. You manage localizations in the settings.json file. For configuration, specify the label key, the language code, and the value for this language in the settings.json file in the locales branch. In this example, you can see a setting option where some labels have been changed.

Configuration file parameters responsible for localization

You manage the localization settings in the settings.json file.

Parameter Data Type Default Description
locale string "en" Preferred locale – a language code in the ISO 639-1 format
locales JSON object {} Object with keys to define locales. Only the keys and language codes whose values you want to override are specified.

Localization application logic

When setting up localization in settings.json, you can specify a preferred locale. To change the widget locale on the fly, use the setLocale method.

The label locale in the widget is defined using the following logic:

  1. Current locale: the link specified during widget initialization or specified by the locale change method. If the current one is not set, then:
  2. Preferred: the one selected in settings.json. If the preferred locale is not set, then:
  3. Default: the en locale.

Priority of label display:

  1. Redefined (overridden) in the setting.json. If they are not set, then:
  2. Default

Structure of the locales section of the settings.json configuration file

{
  "section": {
    "subsection": {
      "element1": {
        "language1": "value for language 1",
        "language2": "value for language 2"
      }
    }
  }
}

Description of localization keys

The final value of the key is an object that contains language code: values for language in the properties of the pair (see the structure)

Error texts

Key Description
1 errors.file.restricted.type Invalid attachment type error text
2 errors.file.restricted.size Invalid attachment size error text
3 errors.file.restricted.not-found Attachment not found error text
4 errors.file.disallowed Disallowed attachment error text
5 errors.file.timeout Attachment timeout error text
6 errors.file.unexpected-error Unexpected file upload error text

Warning about incomplete browser support

Key Description
1 BadBrowser.headerPartial Chat header. Warning about incomplete browser support

Widget chat area

Key Description
1 common.time.today Floating date label (today)
2 common.time.yesterday Floating date label (yesterday)
3 common.typing Identifier that appears when the agent is typing
4 RateIndicator.of The preposition that is used in the results of the CSI request messages: for example, if "ChatMessage": { "of": "out of" } and the score is 4 out of 5, the message will display "4 out of 5"
5 ChatMessage.yourself "You" pronoun in the message header. It shows the client that they are the sender
6 ChatMessage.youWrote "You" label
7 ChatMessage.operatorWrote "Operator" label
8 ChatMessage.audio.compatibility Message that appears in case the browser does not support audio content
8 SocialLinks.text Name of the panel with links to social networks and messengers
9 ChatMessage.audio.errorPlayback Audio file playback error message
10 ChatMessage.audio.errorSpeech Speech recognition error message
11 ChatMessage.audio.quoteInfo Name of the audio message in quotes
12 ChatMessage.downloadError Error message on saving an attachment
13 ChatMessage.sendError undefined
14 ChatMessage.document.quoteInfo Document is name
15 ChatMessage.messageDeleted undefined
16 ChatMessage.messageEdited undefined

Widget chat area

Welcome form and feedback form

Key Description
1 LimitedTextarea.chars Feedback form input field, indicator of the remaining characters to enter: "N character(s)"
2 ChatWelcome.sendWelcome Welcome form: text on the form submission button
3 ChatWelcome.identification.pre.text Welcome form: header of the welcome message
4 ChatWelcome.identification.pre.notice Welсome form: sub-header of the welcome message
5 ChatWelcome.identification.post.text Chat screen after a client enters their number and name: header of the welcome phrase
6 ChatWelcome.identification.post.notice Chat screen after a client enters their number and name: sub-header of the welcome phrase
7 ChatWelcome.form.phone.placeholder Welcome form: prompt for entering the phone number if the mask is not set
8 ChatWelcome.form.email.placeholder Welcome form: prompt for entering the email
9 ChatWelcome.form.name.placeholder Welcome form: prompt for entering the name
10 ChatWelcome.inactivityForm.sent Feedback form: notification after the message is sent
11 ChatWelcome.inactivityForm.sendMessage Feedback form: send button

Welcome form and feedback form

Chat header

Key Description
1 ChatHeader.empty The widget is being initialized and connected
2 ChatHeader.title A client has no active threads, the chat is available
3 ChatHeader.search A client has an active thread, but neither bot nor agent have not been assigned to the chat yet
4 ChatHeader.operatorSubTitle A client has an active thread, a bot or an agent have been already assigned. The agent's role or other information is displayed.
5 ChatHeader.inactive The chat is unavailable

Chat header

Rating requests

Key Description
1 ChatPoll.post.text Text after the client rates the interaction
2 ChatEndPoll.text Text of the rating request sent to the client - suggestion to finish the dialog
3 ChatEndPoll.continue Text of the client's response to the request - suggestion to continue the dialog
4 ChatEndPoll.close Text of the client's response to the request - suggestion to finish the dialog

Rating requests

Message input field

Key Description
1 ChatInput.errorSize Message input field: message about exceeding the allowed size of the attached file
2 ChatInput.errorFormat Invalid format of the attached file error
3 ChatInput.errorBroken Error of the attached corrupted file
3 ChatInput.placeholder Placeholder for entering a message
4 ChatInput.attachments.uploading Message about the attachment upload process
5 ChatInput.attachments.uploaded Message that states the attachment is ready to be sent
6 ChatInput.attachments.error Attachment upload error

Message input field

Client notifications

Key Description
1 Offline.down.text Message that states the connection with the server has been lost (header)
2 Offline.down.notice Message that states the connection with the server has been lost (sub-header)
3 Offline.reconnect Text on the reconnection button
4 WebNotifications.new New message web notification
5 WebNotifications.attachments New attachment web notification

Client notifications

Microphone access warning

Key Description
1 MicrophoneAccessModal.title Microphone access warning (header)
2 MicrophoneAccessModal.text Microphone access warning (sub-header)
3 MicrophoneAccessModal.button Microphone access warning (button)

Microphone access warning

Emoji window localization

Key Description
1 Emoji.recent The Recent tab
2 Emoji.people The Smileys & People tab
3 Emoji.nature The Animals & Nature tab
4 Emoji.foods The Food & Drink tab
5 Emoji.activity The Activity tab
6 Emoji.places The Travel & Places tab
7 Emoji.objects The Objects tab
8 Emoji.symbols The Symbols tab

Emoji window localization

Example of redefining some locales

settings.json:

{
    "locale": "en",

    ... // other settings

    "locales": {
        "ChatWelcome": {
            "remained": {
                "ru": "Осталось"
            },
            "identification": {
                "pre": {
                    "notice": {
                        "ru": "Представьтесь, пожалуйста, и начнём.",
                        "en": "Please, introduce yourself."
                    }
                }
            }
        },
        "ChatInput": {
            "placeholder": {
                "en": "Type your message here..."
            }
        }
    }
}

Default structure and values

{
    "errors": {
        "file": {
            "restricted": {
                "type": {
                    "ru": "Неверный тип файла. Файл не может быть загружен",
                    "en": "Invalid file type. The file cannot be uploaded",
                    "az": "Invalid file type. The file cannot be uploaded",
                    "id": "Invalid file type. The file cannot be uploaded"
                },
                "size": {
                    "ru": "Файл не может быть загружен, невалидный размер файла",
                    "en": "Invalid file size. The file cannot be uploaded",
                    "az": "Invalid file size. The file cannot be uploaded",
                    "id": "Invalid file size. The file cannot be uploaded"
                },
                "not-found": {
                    "ru": "Файл не найден",
                    "en": "File not found",
                    "az": "File not found",
                    "id": "File not found"
                }
            },
            "disallowed": {
                "ru": "Файл не прошел проверку",
                "en": "The file has failed verification",
                "az": "The file has failed verification",
                "id": "The file has failed verification"
            },
            "timeout": {
                "ru": "Попытка загрузки файла завершена по таймауту",
                "en": "The attempt to upload the file is completed by timeout",
                "az": "The attempt to upload the file is completed by timeout",
                "id": "The attempt to upload the file is completed by timeout"
            },
            "unexpected-error": {
                "ru": "Непредвиденная ошибка загрузки файла",
                "en": "Unexpected file upload error",
                "az": "Unexpected file upload error",
                "id": "Unexpected file upload error"
            }
        }
    },
    "BadBrowser": {
        "headerPartial": {
            "ru": "Возможна некорректная работа виджета в вашем браузере. Рекомендуемые браузеры – [Safari](https://www.apple.com/safari/) и [Chrome](https://www.google.com/chrome/)",
            "en": "The widget may work incorrectly in your browser. Recommended browsers are [Safari](https://www.apple.com/safari/) and [Chrome](https://www.google.com/chrome/)",
            "az": "The widget may work incorrectly in your browser. Recommended browsers are [Safari](https://www.apple.com/safari/) and [Chrome](https://www.google.com/chrome/)",
            "id": "The widget may work incorrectly in your browser. Recommended browsers are [Safari](https://www.apple.com/safari/) and [Chrome](https://www.google.com/chrome/)"
        }
    },
    "common": {
        "time": {
            "today": {
                "ru": "сегодня",
                "en": "today",
                "az": "today",
                "id": "hari ini"
            },
            "yesterday": {
                "ru": "вчера",
                "en": "yesterday",
                "az": "yesterday",
                "id": "kemarin"
            }
        },
        "typing": {
            "ru": "печатает...",
            "en": "typing...",
            "az": "typing...",
            "id": "typing..."
        }
    },
    "LimitedTextarea": {
        "chars": {
            "ru": "осталось символов",
            "en": "characters left",
            "az": "qalan işarələr",
            "id": "simbol kiri"
        }
    },
    "ChatHeader": {
        "empty": {
            "ru": "Чат",
            "en": "Chat"
        },
        "title": {
            "ru": "Добро пожаловать в чат!",
            "en": "Welcome to chat"
        },
        "search": {
            "ru": "Поиск оператора",
            "en": "Looking for operator"
        },
        "operatorSubTitle": {
            "ru": "оператор",
            "en": "operator"
        },
        "inactive": {
            "ru": "Чат временно недоступен",
            "en": "Chat temporarily unavailable"
        }
    },
    "ChatWelcome": {
        "sendWelcome": {
            "ru": "Представиться",
            "en": "Start chat",
            "az": "Çata başlamaq",
            "id": "Start chat"
        },
        "identification": {
            "pre": {
                "text": {
                    "ru": "Появились вопросы к нам? Давайте обсудим здесь",
                    "en": "Can we help you? Let's discuss it in chat.",
                    "az": "Sizə necə kömək edə bilərik?",
                    "id": "Bisakah kami membantu Anda? Mari kita bahas dalam obrolan"
                },
                "notice": {
                    "ru": "Представьтесь, пожалуйста, и начнём",
                    "en": "Please, tell us something about yourself",
                    "az": "Zəhmət olmasa, özünüz barədə məlumat verin",
                    "id": "Tolong, beri tahu kami sesuatu tentang diri Anda"
                }
            },
            "post": {
                "text": {
                    "ru": "Спасибо за то, что представились",
                    "en": "Thank you for sharing",
                    "az": "Bölüşdüyünz üçün təşəkkür edirik",
                    "id": "Terima kasih sudah berbagi"
                },
                "notice": {
                    "ru": "Это необходимо для идентификации",
                    "en": "It will help us to support you later",
                    "az": "Bu bizə sizə daha sonra xidmət göstərməyə kömək edəcək",
                    "id": "Ini akan membantu kami untuk mendukung Anda nanti"
                }
            }
        },
        "form": {
            "phone": {
                "placeholder": {
                    "ru": "Номер телефона",
                    "en": "Phone number",
                    "az": "Phone number",
                    "id": "Phone number"
                }
            },
            "email": {
                "placeholder": {
                    "ru": "Электронная почта",
                    "en": "Email",
                    "az": "Email",
                    "id": "Email"
                }
            },
            "name": {
                "placeholder": {
                    "ru": "Ваше имя",
                    "en": "Name",
                    "az": "Name",
                    "id": "Name"
                }
            }
        },
        "inactivityForm": {
            "sent": {
                "ru": "Ваше сообщение отправлено в контактный центр. С Вами свяжется оператор",
                "en": "Your message was sent to the contact center. Wait for the reply"
            },
            "sendMessage": {
                "ru": "Отправить",
                "en": "Send",
                "az": "Göndərmək",
                "id": "Send"
            }
        }
    },
    "ChatPoll": {
        "post": {
            "text": {
                "ru": "Спасибо за вашу оценку",
                "en": "We appreciate your choice",
                "az": "Seçiminiz üçün təşəkkür edirik!",
                "id": "Kami menghargai pilihan Anda"
            }
        }
    },
    "ChatEndPoll": {
        "text": {
            "ru": "Вы получили ответы на все вопросы, завершить консультацию?",
            "en": "Do you have any other questions for us?",
            "az": "Əlavə sualınız olacaqmı?",
            "id": "Apakah Anda memiliki pertanyaan lain untuk kami?"
        },
        "continue": {
            "ru": "Продолжить",
            "en": "Yes",
            "az": "Bəli",
            "id": "Ya"
        },
        "close": {
            "ru": "Завершить",
            "en": "No",
            "az": "Xeyr",
            "id": "Tidak"
        }
    },
    "ChatInput": {
        "errorSize": {
            "ru": "превышен максимальный размер",
            "en": "the uploaded file exceeds the",
            "az": "Yüklədiyiniz fayl ….. aşır",
            "id": "the uploaded file exceeds the"
        },
        "errorFormat": {
            "ru": "недопустимый формат файла",
            "en": "invalid file format",
            "az": "Yanlış fayl formatı",
            "id": "invalid file format"
        },
        "errorBroken": {
            "ru": "Файл поврежден",
            "en": "The file is corrupted",
            "az": "The file is corrupted",
            "id": "The file is corrupted"
        },
        "placeholder": {
            "ru": "Ваше сообщение...",
            "en": "Type your message here...",
            "az": "Mesajınızı burada yazın...",
            "id": "Masukan pesan anda disini..."
        },
        "attachments": {
            "uploading": {
                "ru": "Загрузка вложения...",
                "en": "Uploading...",
                "az": "Yüklənir...",
                "id": "Uploading..."
            },
            "uploaded": {
                "ru": "Готов. Отправить – Enter",
                "en": "uploaded. Press Enter",
                "az": "Yükləndi. Enter-i tıklayın",
                "id": "uploaded. Press Enter"
            },
            "error": {
                "ru": "Не удалось загрузить вложение",
                "en": "Upload failed",
                "az": "Yükləmə baş tutmadı",
                "id": "Upload failed"
            }
        }
    },
    "RateIndicator": {
        "of": {
            "ru": "из",
            "en": "of",
            "az": "of",
            "id": "of"
        }
    },
    "ChatMessage": {
        "yourself": {
            "ru": "Вы",
            "en": "You"
        },
        "youWrote": {
            "ru": "Вы",
            "en": "You"
        },
        "operatorWrote": {
            "ru": "Оператор {{name}}",
            "en": "Operator {{name}}"
        },
        "audio": {
            "compatibility": {
                "ru": "Ваш браузер не поддерживает аудио контент",
                "en": "Your browser does not support audio playback",
                "id": "Your browser does not support audio playback",
                "az": "Your browser does not support audio playback"
            },
            "errorPlayback": {
                "ru": "Аудио сообщение не может быть воспроизведено",
                "en": "Audio message can't be played",
                "id": "Audio message can't be played",
                "az": "Audio message can't be played"
            },
            "errorSpeech": {
                "ru": "Ошибка распознавания",
                "en": "Recognition error",
                "id": "Recognition error",
                "az": "Recognition error"
            },
            "quoteInfo": {
                "ru": "аудиосообщение",
                "en": "audio message",
                "id": "audio message",
                "az": "audio message"
            }
        },
        "downloadError": {
            "ru": "Ошибка загрузки",
            "en": "Download error"
        },
        "sendError": {
            "ru": "Сообщение не отправлено",
            "en": "The message has not been sent"
        },
        "document": {
            "quoteInfo": {
                "ru": "документ",
                "en": "document",
                "id": "dokumen",
                "az": "sənəd"
            }
        },
        "messageDeleted": {
            "ru": "Сообщение удалено",
            "en": "Deleted message"
        },
        "messageEdited": {
            "ru": "ред.",
            "en": "ed."
        }
    },
    "Offline": {
        "down": {
            "text": {
                "ru": "Потеряна связь с сервером",
                "en": "Connection is dropped",
                "az": "Bağlantı kəsildi",
                "id": "Connection is dropped"
            },
            "notice": {
                "ru": "проверьте ваше подключение к сети интернет",
                "en": "check your internet connection",
                "az": "İnternetlə bağlantınızı yoxlayın",
                "id": "check your internet connection"
            }
        },
        "reconnect": {
            "ru": "Подключиться снова",
            "en": "Reconnect",
            "az": "Təkrar bağlan",
            "id": "Reconnect"
        }
    },
    "WebNotifications": {
        "new": {
            "ru": "Новое сообщение: ",
            "en": "New message: ",
            "az": "Yeni mesaj: ",
            "id": "New message: "
        },
        "attachments": {
            "ru": "Новое вложение",
            "en": "New attachment",
            "az": "New attachment",
            "id": "New attachment"
        }
    },
    "SocialLinks": {
        "text": {
            "ru": "Спросить в мессенджере",
            "en": "Ask in the messenger",
            "id": "Bertanya the messenger"
        }
    },
    "MicrophoneAccessModal": {
        "title": {
            "ru": "Нет доступа к микрофону",
            "en": "No access to your microphone"
        },
        "text": {
            "ru": "Чтобы записать голосовое сообщение, разрешите доступ к микрофону в настройках браузера",
            "en": "To be able to record voice messages, you need to allow access to your microphone in the browser settings"
        },
        "button": {
            "ru": "Понятно",
            "en": "Ok"
        }
    },
    "Emoji": {
        "recent": {
            "ru": "Недавние",
            "en": "Frequently Used",
            "id": "Sering digunakan",
            "az": "Son istifadə olunmuş"
        },
        "people": {
            "ru": "Смайлики и люди",
            "en": "Smileys & People",
            "id": "Smiley & Orang",
            "az": "Smayllar və insanlar"
        },
        "nature": {
            "ru": "Животные и природа",
            "en": "Animals & Nature",
            "id": "Hewan & Alam",
            "az": "Heyvanlar və təbiət"
        },
        "foods": {
            "ru": "Еда и напитки",
            "en": "Food & Drink",
            "id": "Makanan Minuman",
            "az": "Qida və içkilər"
        },
        "activity": {
            "ru": "Активности",
            "en": "Activity",
            "id": "Aktivitas",
            "az": "Fəallıq"
        },
        "places": {
            "ru": "Путешествия и места",
            "en": "Travel & Places",
            "id": "Travel & Places",
            "az": "Səyahət və yerlər"
        },
        "objects": {
            "ru": "Предметы",
            "en": "Objects",
            "id": "Benda",
            "az": "Əşyalar"
        },
        "symbols": {
            "ru": "Символы",
            "en": "Symbols",
            "id": "Simbol",
            "az": "Simvollar"
        }
    }
}
Clone this wiki locally