Javascript SDK

  1. Home
  2. Docs
  3. Javascript SDK
  4. Configuration

Configuration

When initializing Teral, using the init method, you need to pass a config object. Below are the different options you can use:

  • apiKey
  • sourceLanguage
  • currentLanguage
  • excludePaths
  • ignoreClasses
  • hideSwitcher
  • debug

apiKey:

This is the apiKey that represents your website. You can find it the project settings in your account. This field is required.

sourceLanguage:

This is the original language your site is in. This is optional.

currentLanguage:

This is the currently translated language your site is in, This field is optional. If you would like to translate the page by default simply set this value.

For example to translate the site to french by default we can set it to fr.

excludePaths:

An array of paths to not translate. This is optional.

For example, if do not want the following sections (example.com/foo/ and example.com/bar/) of your site to not be translated, you could pass the following array [“/foo“, “/bar“]

ignoreClasses:

This is an array of CSS classes of elements that should not be translated. This field is optional.

For example, if you have a CSS class called userData that you do not want to translate, simply pass this array [“userData“]

hideSwitcher:

This is a boolean value used to hide the default language switcher. This defaults to false and is optional. If you would like to hide the default language switcher, simply set it to true. For more information about using a custom language switcher, please https://teral.crunch.help/setup-instructions/how-to-use-a-custom-html-to-customize-the-language-switcher

debug:

This is a boolean value that specifies whether to enable debugging mode or not. This defaults to false. This field is optional

Was this article helpful to you? Yes No

How can we help?