Here’s the translated text in English:
Configuration
The HTApi
class is the main entry point for all configuration of the library. Through the class constructor, you can provide all the necessary initial configuration.
An example of a complete configuration could be as follows:
new window.HTApi({
token: "YOUR TOKEN",
avatar: "HUGO",
language: "enUS",
signLanguage: "en-ase",
parentElement: document.body,
enableComponents: {
widget: true,
promptLink: true,
},
theme: {
translatorButtonBackground: "blue",
translatorButtonBorder: "white",
translatorButtonForeground: "white",
widgetBackground: "black",
widgetBorder: "white",
widgetForeground: "white",
widgetPosition: "left",
},
});
Except for the token
field, all other fields have a default value.
token
- type:
string
This field receives the access key obtained during the contract with Hand Talk S.A. With it, the library can authenticate its requests and ensure access to its resources.
ATTENTION
Whenever you change the release channel between beta
and latest
, the token
field must be changed, since these two channels use different tokens for authentication. Failing to make this change will result in the denial of translation requests.
The latest
and fixed version
channels use the same token.
See more information in Release channels
avatar
- type:
string
- default:
HUGO
- options:
HUGO
,MAYA
This field can accept two values: HUGO
or MAYA
and serves to determine which 3D character will appear during the translations.
language
- type:
string
- default:
ptBR
- options:
ptBR
,enUS
,esES
Field that defines the application's language. It translates texts, areas, and other textual elements into the chosen language.
ATTENTION
This field does not change the sign language that the library will translate; it only serves for the internationalization of internal components and HTML elements. To change the sign language, use the signLanguage
field.
signLanguage
- type:
string
- default:
ptBR-bzs
- options:
ptBR-bzs
,en-ase
Field that defines which sign language will be used to translate the provided texts.
parentElement
- type:
HTMLElement
- default:
document.body
This field defines the parent element where the library will allocate itself and is useful for determining the hierarchy of the library's elements; that is, the components, translation window, etc., will be hierarchically located as children of the element passed in parentElement
. By default, the parent element is the body of your HTML.
enableComponents
- type:
object
- default:
{
"widget": true,
"promptLink": true
}
This field serves to enable or disable the components of the library. Each field is optional, and it is not necessary to provide all values. We recommend using this property if you want to deactivate the components provided by the library and create your own implementations.
ATTENTION
The translation window cannot be disabled, as it is the one that displays the translations.
widget
- type:
boolean
- default:
true
Enables or disables the library's widget.
promptLink
- type:
boolean
- default:
true
Enables or disables the library's prompt link.
theme
- type:
object
- default:
{
"activationButton": {
"border": "#FFFFFF",
"background": "#003087",
"foreground": "#FFFFFF"
},
"promptLink": {
"border": "#FFFFFF",
"background": "#2E2E2E",
"foreground": "#FFFFFF"
},
"widget": {
"border": "#FFFFFF",
"background": "#2E2E2E",
"foreground": "#FFFFFF"
}
}
This field is used to customize the style of the library's elements. Each field is optional, and it is not necessary to provide all values.
activationButton
border
- type:
string
- default:
#FFFFFF
Defines the border color of the library's activation button.
background
- type:
string
- default:
#003087
Defines the background color of the library's activation button.
foreground
- type:
string
- default:
#FFFFFF
Defines the text color of the library's activation button.
promptLink
border
- type:
string
- default:
#FFFFFF
Defines the border color of the library's prompt link.
background
- type:
string
- default:
#2E2E2E
Defines the background color of the library's prompt link.
foreground
- type:
string
- default:
#FFFFFF
Defines the text color of the library's prompt link.
widget
border
- type:
string
- default:
#FFFFFF
Defines the border color of the library's widget.
background
- type:
string
- default:
#2E2E2E
Defines the background color of the library's widget.
foreground
- type:
string
- default:
#FFFFFF
Defines the text color of the library's widget.