• Jodit
  • PRO
  • Builder
  • Getting Started
  • Playground
  • Examples
  • Documentation
  • Download
  • Overview
  • Issue tracker
  • Docs
  • Plugins
  • Demo
  • Pricing
  • File Browser Pro
  • Sign in
Get connected wth us on social networks!

Footer

Jodit Core

  • Jodit Home page
  • Documentation
  • Playground
  • Examples
  • Github
  • Issues

Integration

  • Jodit React
  • Jodit Angular
  • Jodit Vue
  • Jodit Yii2
  • Jodit Joomla

PRO/OEM plugins

  • AutoComplete
  • Backup Plugin
  • Button Generator
  • Change case
  • Custom Color Picker
  • Emoji
  • Finder
  • Google Search
  • Paste code
  • Show Blocks
  • Virtual Keyboard
  • Tune block
  • Highlight signature
  • Google Maps Editor
  • Export in PDF
  • Page Break
  • Iframe Editor
  • Paste from Word PRO
  • Mobile View
  • ToDo List
  • Translate

Links

  • Demo PRO/OEM
  • Demo FileBrowser PRO
  • Price
  • License
  • Support
  • For resellers

Versions

  • site v.0.1.823
  • Jodit PRO v.4.6.9
  • Jodit v.4.6.2
  • All versions
2025 © Copyright: XDSoft.net <support@xdsoft.net>
  • Getting started

    • Installation
    • Usage
    • Support
    • FAQs
    • Cloud
    • Examples
  • How to

    • Create plugin
    • Add custom button
    • Add custom font in the font list
    • How to create module
    • How to generate license key
    • How to make a backend finder
    • How to set up document view
  • Modes

    • Source mode
  • Customisation

    • Theme
    • Keyboard
  • API

    • License Rest API
    • JS API
  • Changelog

  • Plugins

    • AutoComplete
    • Backup Plugin
    • Button Generator
    • Change case
    • Custom Color Picker
    • Emoji
    • Finder
    • Google Search
    • Paste code
    • Show Blocks
    • Virtual Keyboard
    • Tune block
    • Highlight signature
    • Google Maps Editor
    • Export in PDF
    • Page Break
    • Iframe Editor
    • Paste from Word PRO
    • Mobile View
    • ToDo List
    • Translate

Translate Plugin

This plugin adds translation capabilities to the Jodit editor, allowing users to translate selected text directly within the editor. It provides a toolbar button for translation and supports different translation providers.

Features

  • Translate selected text with a single click
  • Support for Google Translate API
  • Support for custom translation providers
  • Configurable source and target languages
  • Keyboard shortcuts for quick translation

Installation

<!doctype html> <html> <head> <title>Translate Editor</title> <meta charset="utf-8" /> <!-- css --> <link rel="stylesheet" href="./node_modules/jodit-pro/build/jodit.css" /> <link rel="stylesheet" href="./node_modules/jodit-pro/build/plugins/translate/translate.css" /> </head> <body> <!-- element --> <textarea id="entry">...</textarea> <!-- js --> <script src="./node_modules/jodit-pro/build/jodit.js"></script> <script src="./node_modules/jodit-pro/build/config.js"></script> <script src="./node_modules/jodit-pro/build/plugins/translate/translate.js"></script> <!-- call --> <script> Jodit.make('#entry', { extraPlugins: ['translate'], translate: { provider: 'google', googleProviderOptions: { key: '{YOUR_GOOGLE_API_KEY}' } } }); </script> </body> </html>
Copy

Options

translate.provider

  • Type: 'google' | ITranslateProviderFactory
  • Default: 'google'
  • Required: true

Translation engine provider. You can use:

  • 'google' - Google Translate API
  • A custom function that implements the ITranslateProviderFactory interface (see Custom Translate Provider example)
Jodit.make('#editor', { translate: { provider: 'google' } });
Copy

translate.defaultSourceLang

  • Type: string
  • Default: '' (empty string, which means auto-detection)
  • Required: false

Default source language for translation. Use language ISO-639-1 codes. If not specified, the plugin will try to auto-detect the source language.

Jodit.make('#editor', { translate: { defaultSourceLang: 'en' } });
Copy

translate.defaultTargetLang

  • Type: string
  • Default: 'de'
  • Required: true

Default target language for translation. Use language ISO-639-1 codes.

Jodit.make('#editor', { translate: { defaultTargetLang: 'fr' } });
Copy

translate.hotkeys

  • Type: object
  • Default:
{ translateSelection: ['ctrl+shift+o', 'cmd+shift+o'], translateOptions: ['ctrl+shift+p', 'cmd+shift+p'] }
Copy

Keyboard shortcuts for translation functions.

Jodit.make('#editor', { translate: { hotkeys: { translateSelection: ['ctrl+alt+t'], translateOptions: ['ctrl+alt+o'] } } });
Copy

translate.googleProviderOptions

  • Type: object
  • Default:
{ url: 'https://translation.googleapis.com/language/translate/v2', key: '' }
Copy

Options for Google Translate API.

translate.googleProviderOptions.key

  • Type: string
  • Default: ''
  • Required: true (when using Google Translate provider)

API key for using Google Translate engine. Get API key

Jodit.make('#editor', { translate: { provider: 'google', googleProviderOptions: { key: 'YOUR_GOOGLE_API_KEY' } } });
Copy

translate.googleProviderOptions.url

  • Type: string
  • Default: 'https://translation.googleapis.com/language/translate/v2'
  • Required: false

URL for Google Translate API. You typically don't need to change this unless you're using a proxy or a different endpoint.

Jodit.make('#editor', { translate: { provider: 'google', googleProviderOptions: { url: 'https://your-proxy.com/google-translate', key: 'YOUR_GOOGLE_API_KEY' } } });
Copy

Custom Translate Provider

You can create your own translation provider by implementing the ITranslateProviderFactory interface. This function should return an object with two methods:

  1. translate(text, from, to) - Translates text from one language to another
  2. supportedLanguages() - Returns a list of supported languages
import { JoditPro } from 'jodit-pro'; JoditPro.make('#editor', { language: 'en', buttons: ['translate.translate'], extraPlugins: ['translate'], translate: { provider: (jodit) => { return { supportedLanguages() { return Promise.resolve({ langs: { English: 'en', Russian: 'ru', German: 'de' } }); }, translate(text, from, to) { return fetch( 'https://your-translate-service.com/?text=' + encodeURIComponent(text) + '&from=' + encodeURIComponent(from || jodit.o.language) + '&to=' + encodeURIComponent(to) ) .then((resp) => resp.json()) .then((data) => { return { text: data.translation.text }; }); } }; } } });
Copy

Usage Examples

Basic Usage with Google Translate

import { JoditPro } from 'jodit-pro'; JoditPro.make('#editor', { language: 'en', buttons: ['translate.translate'], extraPlugins: ['translate'], translate: { provider: 'google', defaultSourceLang: 'en', defaultTargetLang: 'fr', googleProviderOptions: { key: 'YOUR_GOOGLE_API_KEY' } } });
Copy

Using Custom Translation Service

import { JoditPro } from 'jodit-pro'; JoditPro.make('#editor', { language: 'en', buttons: ['translate.translate'], extraPlugins: ['translate'], translate: { provider: (jodit) => { return { supportedLanguages() { // Return only the languages your service supports return Promise.resolve({ langs: { English: 'en', Spanish: 'es', French: 'fr', German: 'de', Italian: 'it' } }); }, translate(text, from, to) { // Use your own translation API return fetch(`https://api.your-translation-service.com/translate`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({ text, source_language: from || 'auto', target_language: to }) }) .then(response => response.json()) .then(data => { return { text: data.translated_text }; }); } }; }, defaultTargetLang: 'es' } });
Copy

Customizing Keyboard Shortcuts

import { JoditPro } from 'jodit-pro'; JoditPro.make('#editor', { buttons: ['translate.translate'], extraPlugins: ['translate'], translate: { provider: 'google', googleProviderOptions: { key: 'YOUR_GOOGLE_API_KEY' }, hotkeys: { translateSelection: ['alt+t'], translateOptions: ['alt+o'] } } });
Copy

How It Works

  1. When text is selected in the editor, the user can click the "Translate" button or use the keyboard shortcut
  2. The plugin sends the selected text to the configured translation provider
  3. The translated text replaces the selected text in the editor
  4. Users can also access translation options to change source and target languages

This plugin is particularly useful for multilingual content creation and editing, allowing users to quickly translate portions of text without leaving the editor.

Demo

A forest is an ecosystem represented by a variety of trees. Forests are deciduous, coniferous, oak and mixed species. Tundra and taiga also belong to forest varieties. The forest is called "the lungs of the planet", because it produces a huge amount of oxygen, and conifers saturate the air with vital nitrogen. But unfortunately, excessive deforestation and forest fires lead to a decrease in oxygen production, as well as to soil erosion and a reduction in the range of animals and insects.

Button

Way through the yellow forest
Photo by Patrick Fore on Unsplash

Some people think that the forest is a lot of trees and a bunch of annoying insects. But the forest is a fairy tale where you can meet many interesting and unusual things. In the forest, besides trees, a lot of shrubs and other plants grow. Forest glades are covered with many berries and mushrooms. Mushroom pickers visit the forest behind honey agarics, aspen mushrooms, boletus mushrooms, brown mushrooms, chanterelles. And those who decide to just walk through the forest will always be able to pick up a small basket of berries such as blueberries, strawberries, raspberries.