Skip to content

Integrates the WEB-T translation API into the block editor to translate post content while editing.

License

Notifications You must be signed in to change notification settings

RRZE-Webteam/rrze-webt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RRZE WEB-T Translator

Integrates the WEB-T translation API into the WordPress block editor so authors can translate posts (title and content) without leaving the editor.

Features

  • Sidebar panel in the block editor to trigger WEB-T translations.
  • Supports both synchronous and asynchronous responses from WEB-T via custom REST endpoints.
  • Translation history limited to the three most recent jobs per post with detailed status (pending/completed/failed).
  • Manual source/target selections.
  • Stores translations in post meta to keep context across sessions.

Requirements

  • WordPress 6.8 or newer.
  • PHP 8.2 or newer.
  • Valid WEB-T (eTranslation) API credentials (application name & password).

Installation

  1. Copy the plugin folder into wp-content/plugins/.
  2. Activate RRZE WEB-T Translator via Plugins → Installed Plugins in WordPress.
  3. Go to Settings → WEB-T Translator and configure your API endpoint, application name, and password.
  4. Open any post in the block editor, use the WEB-T Translation sidebar to request translations.

Configuration

Setting Description
API Endpoint URL Full URL to the WEB-T translate endpoint, e.g. https://webgate.ec.europa.eu/etranslation/si/translate.
Application Name Application identifier provided by WEB-T.
Password Password/secret for the application.

Usage

  1. Edit or create a post using the block editor.
  2. Open the WEB-T Translation panel from the sidebar.
  3. Choose the target language (defaults to the site language).
  4. Choose a source language.
  5. Click Translate content. A job is created and monitored until WEB-T responds.
  6. When complete, the post title and content update automatically. The translation history shows job details.

Development

  • PHP autoloading follows PSR-4 via spl_autoload_register (namespace RRZE\WebT).
  • Source assets live in src/ (ESNext + SCSS). Compiled and minified files are emitted to build/ by the npm scripts.
  • Translation jobs are stored in post meta (_rrze_webt_job_*), with an index key _rrze_webt_jobs_index.
  • REST endpoints reside in includes/RestController.php (namespace rrze-webt/v1).

Scripts

  • npm run build – Bundles src/editor.js and src/editor.scss into build/editor.js and build/editor.css.
  • npm run start – Watches the same sources and rebuilds into build/ on changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Integrates the WEB-T translation API into the block editor to translate post content while editing.

Resources

License

Stars

Watchers

Forks

Packages

No packages published