Skip to main content

Options

Full list of configuration options

Website Translator determines target language automatically if the webpage uses lang parameter in URL query.

Website Translator supports ISO 639-1 language codes with optional ISO 3166-1 alpha-2 country codes. If language is not found with specified country code, then Website Translator checks if language without country code is available.

WebsiteTranslator.Options.currentLanguage

  • Type: String

  • Default: null

    Current web page language (if the web page is already pre-translated). The language in which the website has been translated. When currentLanguage is not equal to source language, selecting language to translate, Website Translator will try to get page in language by calling translation.onLanguageSelected(language)

WebsiteTranslator.Options.debug

  • Type: Boolean

  • Default: false

    Enable verbose logging in console


Translation API options

WebsiteTranslator.Options.api.clientId

  • Type: String

  • Default: null

    Authorization key which allows Website Translator to access translation API Required

WebsiteTranslator.Options.api.services.Translation

  • Type: String

  • Default: NLTP platform

    Translation service Uri

WebsiteTranslator.Options.api.services.Authentication

  • Type: String

  • Default: xxxxxxxxx

    Authentication service Uri


Translation options

WebsiteTranslator.Options.translation.autoTranslate

  • Type: Boolean

  • Default: true

    Save last translation target language and on next page load, automatically translate to it.

    if browser url contains lang parameter in url, Website Translator will use it for translation. Otherwise if lang parameter is not available, saved language will be used.

WebsiteTranslator.Options.translation.translateOnlyAllowedTags

  • Type: Boolean

  • Default: false

    Translate only tags and their children which have translate="yes" attribute

WebsiteTranslator.Options.translation.translateAttributes

  • Type: Boolean

  • Default: true

    Translate HTML attributes

WebsiteTranslator.Options.translation.onLanguageSelected

  • Type: Function

  • Default: () => Promise.resolve(false)

    Custom actions on selecting languages. This function if implemented should return Boolean -> true when Language must be Translated with Website Translator, false otherwise

WebsiteTranslator.Options.translation.thirdPartyTranslationLanguages

  • Type: Array<string>

  • Default: []

    Define languages which are supposed to be translated with third party


UI options

WebsiteTranslator.Options.ui.headless

  • Type: Boolean

  • Default: false

    Hide MT toolbar with translation progress.

WebsiteTranslator.Options.ui.tooltipShowDelay

  • Type: Number

  • Default: 500

    How much time to wait after user is started to hover translation to show suggestion popup (in ms)

WebsiteTranslator.Options.ui.toolbarPosition

  • Type: String

  • Default: bottom

    Where toolbar is positioned. Values can be:

    • "top" - Show translation toolbar at the top of the page
    • "bottom" - Show translation toolbar at the bottom of the page

WebsiteTranslator.Options.ui.mainContentElement

  • Type: HTMLElement

  • Default: null

    Main container HTMLElement for web page that contains all scrollable content

WebsiteTranslator.Options.ui.showPopup

  • Type: Boolean

  • Default: true

    Show or hide translation popup Also when disabled, highlight for translated sentences won't be visible.

WebsiteTranslator.Options.ui.showLanguagesInNativeLanguage

  • Type: Boolean

  • Default: false

    Show languages in native language for example in Language Menu

WebsiteTranslator.Options.ui.translate

  • Type: String

  • Default: source

    Translate UI, values can be:

    • source - Show UI in source language
    • target - Show UI in target language

WebsiteTranslator.Options.ui.showTranslationControls

  • Type: Boolean

  • Default: true

    Show or hide "restore" and "cancel" translation buttons on UI

WebsiteTranslator.Options.ui.layout

  • Type: String

  • Default: menu

    Change display mode of the language selection in UI, values can be:

    • "menu" - Show available languages in select
    • "list" - Show available languages as list items
    • null - Hide language menu