Version: 1.2.2
A lightweight WordPress multilingual plugin with Google Translate API integration, visual translation editor, and frontend language switcher shortcode. Inspired by TranslatePress — built as a simplified, self-hosted alternative.
- Unlimited Languages — Select a source language and add as many target languages as needed
- Google Translate API v2 — Automatic machine translation with result caching in the database
- Output Buffering Translation — Intercepts rendered HTML and replaces text content,
title,alt,placeholderattributes, meta tags, and page title - Language Switcher Shortcode —
[thst_language_switcher]renders a dropdown (or list) for language selection - Table Editor — Spreadsheet-like admin UI to browse, search, edit, and delete translations per language
- Visual Editor — TranslatePress-inspired side-by-side editor with page preview iframe, sidebar string list, inline editing, and per-string auto-translate
- Admin Bar Integration — "🌐 Übersetzen" link on every frontend page opens the visual editor for that URL
- Cookie-Based Language — No URL rewriting or subdirectories; clean and compatible with all themes
notranslateOpt-out — Addclass="notranslate"to any HTML element to prevent its translation (industry standard, works on frontend and in REST API filter)
| Requirement | Minimum |
|---|---|
| PHP | 7.4+ |
| WordPress | 5.8+ |
| SSL | Recommended |
| Google Cloud Account | Required for automatic translation |
cd wp-content/plugins/
git clone git@github.com:hacklaen/th-simple-translate.gitActivate via Plugins → Activate in WordPress admin. The plugin automatically creates its database table on activation.
See the Setup Runbook for detailed configuration instructions.
- Go to Simple Translate → Einstellungen
- Select your source language (e.g., German)
- Add target languages (e.g., English, French)
- Enter your Google Translate API Key (how to get one)
- Enable Automatische Übersetzung
- Save settings
- Add
[thst_language_switcher]to a widget area or page - Visit your site and switch languages — done!
th-simple-translate/
├── th-simple-translate.php # Entry point, singleton bootstrap
├── includes/
│ ├── class-database.php # DB schema, CRUD, language list
│ ├── class-settings.php # Admin settings page
│ ├── class-google-translate.php # Google Translate API v2 client
│ ├── class-translation-render.php # Output buffering & page translation
│ ├── class-shortcode.php # [thst_language_switcher] shortcode
│ └── class-editor.php # Visual editor & table editor AJAX
├── assets/
│ ├── css/ (admin.css, editor.css, frontend.css)
│ └── js/ (admin.js, editor.js)
└── docs/ # Documentation
All translations are stored in a single table (wp_thst_translations) with a SHA-256 hash index for fast lookups. Translation statuses: 0 = untranslated, 1 = machine, 2 = manually edited.
Page Request → output buffer → extract text nodes (regex)
→ skip notranslate regions → bulk DB lookup
→ auto-translate missing via Google API
→ cache in DB → replace text in HTML (preserve notranslate)
→ serve translated page
| Shortcode | Description |
|---|---|
[thst_language_switcher] |
Language selection dropdown |
[thst_language_switcher style="list"] |
Language selection as horizontal link list |
| Page | Menu Location | Purpose |
|---|---|---|
| Einstellungen | Simple Translate → Einstellungen | Source/target languages, API key, auto-translate toggle |
| Übersetzungen | Simple Translate → Übersetzungen | Table editor: browse, search, edit, delete per language |
| Visueller Editor | Simple Translate → Visueller Editor | Side-by-side iframe editor with live page preview |
| Document | Description |
|---|---|
| Architecture | Plugin structure, DB schema, translation pipeline |
| API Reference | AJAX endpoints, shortcodes, hooks, notranslate opt-out |
| Google Translate | API setup, pricing, troubleshooting |
| Setup Runbook | Step-by-step installation and configuration |
GPL2