=== TransLeti Connector ===
Contributors: transleti, grupobouso
Tags: translation, automatic translation, multilingual, translatepress, wpml
Requires at least: 5.0
Tested up to: 6.9
Stable tag: 1.9.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Translate your entire WordPress site automatically using LibreTranslate. Works with TranslatePress and WPML. Unlimited translations, no per-word fees.

== Description ==

**Transleti Connector** turns [LibreTranslate](https://libretranslate.com/) into a full-featured translation engine for WordPress. It integrates seamlessly with **TranslatePress** and **WPML**, giving you unlimited automatic translations at zero cost per word.

Unlike cloud translation services that charge per character, Transleti offers unlimited automatic translations through its dedicated translation infrastructure at a flat monthly rate. No per-word fees, no surprises.

= Why Transleti? =

* **Truly unlimited** — No per-word or per-character fees. Translate as much content as you need.
* **Works with what you already use** — Connects to TranslatePress or WPML. No need to switch your multilingual plugin.
* **29 languages** — English, Spanish, French, German, Italian, Portuguese, Dutch, Swedish, Danish, Bulgarian, Czech, Estonian, Finnish, Greek, Hungarian, Indonesian, Japanese, Korean, Norwegian, Polish, Romanian, Russian, Thai, Turkish, Ukrainian, Arabic, Chinese, Hindi, and Vietnamese.
* **Privacy-first** — Translations are processed on Transleti's own dedicated servers. Your content never passes through third-party clouds like Google or Amazon.

= Automatic Translation That Actually Works =

Transleti doesn't just translate text — it understands your content structure:

* **Elementor** — Translates content directly from `_elementor_data` JSON, not the fallback HTML. Works with any Elementor addon (ElementsKit, starter themes, etc.).
* **Gutenberg** — Parses blocks and translates both visible text and block attributes (headings, buttons, captions, placeholders). Supports GenerateBlocks, Spectra, Kadence, and more.
* **Classic Editor** — Standard HTML content translation with full tag preservation.
* **WooCommerce** — Product titles, descriptions, attributes, and category/tag names.
* **Menus** — Automatically duplicates and translates navigation menus for each language.
* **Slugs** — Translates URL slugs for SEO-friendly multilingual permalinks.
* **SEO Titles** — Translates `post_title` so SEOPress, Yoast, and AIOSEO display correct titles in every language.

= Smart Translation Features =

* **8-Phase Batch Processor** — Automated cron translates posts, page builder strings, widget strings, slugs, menus, SEO titles, re-translations, and fixes internal links. Runs in the background without manual intervention.
* **Manual Edit Protection** — If you manually edit a translation, Transleti remembers and preserves your changes during re-translations.
* **Do Not Translate List** — Protect brand names, technical terms, and other words that should never be translated (e.g., WordPress, WooCommerce, your brand name).
* **Change Detection** — Monitors content changes via MD5 hashing. When you update a post, only that post gets re-translated.
* **SVG & HTML Preservation** — Complex HTML structures, inline SVGs, and shortcodes pass through translation intact.
* **Translation Dashboard** — A dashboard widget shows real-time progress: how many posts, strings, and slugs are translated per language.

= SEO-Safe Untranslated Page Handling =

Pages that haven't been translated yet return a **503 (Service Unavailable)** status with a `Retry-After` header, telling search engines to come back later. This prevents mixed-language content from being indexed while translations are in progress. The page is shown in the visitor's language with a clear message and links to the homepage or the original-language version.

= Remote Diagnostics & Theme Compatibility Support =

Having translation issues? From **Settings > Transleti > Support**, send a one-click diagnostic report to the Transleti team. The report includes your environment info, translation status, active plugins, and recent errors — no passwords or personal data. You can also specify a problematic page by URL or ID to include a detailed content comparison (original vs. translated) across all languages.

Our team uses these reports to identify and resolve theme compatibility issues, page builder conflicts, and translation problems — often without needing direct access to your site.

= How It Works =

1. Install and activate Transleti Connector.
2. Go to **Settings > Transleti** and select your multilingual plugin (TranslatePress or WPML).
3. Enter your API key from [transleti.com](https://transleti.com).
4. Translations start automatically via WordPress cron — no manual action needed.

= Requirements =

* WordPress 5.0 or higher
* PHP 7.4 or higher
* TranslatePress (free or Pro) **or** WPML with String Translation
* A Transleti API key ([get one at transleti.com](https://transleti.com))

== External Services ==

This plugin connects to external services for translation and management. Below is a full disclosure of each service, what data is sent, and when.

= LibreTranslate / Transleti Translation API =

This plugin sends your content to the Transleti translation API for machine translation. The service is powered by LibreTranslate running on Transleti's own dedicated servers.

* **What data is sent**: Text content from your posts, pages, and strings that need translation.
* **When data is sent**: During automatic batch translation (WordPress cron) and when the TranslatePress on-the-fly translator triggers for untranslated strings on page load.
* **Default service URL**: `https://sv1.transleti.com` (configurable)
* **Service provider**: [Transleti](https://transleti.com)
* [Transleti Terms of Service](https://transleti.com/terms/)
* [Transleti Privacy Policy](https://transleti.com/privacy/)

= Transleti API Gateway (Key Validation & Activation) =

When using a Transleti API key, the plugin validates your subscription status and activates your domain with the Transleti API gateway.

* **What data is sent**: Your API key and site domain for validation and activation.
* **When data is sent**: When saving plugin settings (activation), and periodically during translation batches (validation, cached for 1 hour).
* **Service URL**: `https://api.transleti.com/v1/validate` and `https://api.transleti.com/v1/activate`
* **Service provider**: [Transleti](https://transleti.com)
* [Transleti Terms of Service](https://transleti.com/terms/)
* [Transleti Privacy Policy](https://transleti.com/privacy/)

= Transleti External Cron Service =

When enabled in settings, this plugin registers your site with the Transleti cron service, which pings your site's `wp-cron.php` every minute to ensure scheduled translations run on time.

* **What data is sent**: Your site URL and site name for registration.
* **When data is sent**: When enabling or disabling the external cron feature in **Settings > Transleti**, and when checking cron status.
* **Service URL**: `https://api.transleti.com/v1/cron`
* **Service provider**: [Transleti](https://transleti.com)
* [Transleti Terms of Service](https://transleti.com/terms/)
* [Transleti Privacy Policy](https://transleti.com/privacy/)

= Transleti Diagnostic Report Service =

When you click "Send Diagnostic Report" in **Settings > Transleti > Support**, the plugin collects non-sensitive site information and sends it to the Transleti support team.

* **What data is sent**: WordPress/PHP version, active theme, plugin list (names and versions only), translation status per language, LibreTranslate connectivity test, recent Transleti-related error log entries, and optionally a content comparison for a specific post. No passwords, API keys, or personal data are included.
* **When data is sent**: Only when you manually click the "Send Diagnostic Report" button. Never sent automatically.
* **Service URL**: `https://api.transleti.com/v1/diagnostic/submit`
* **Service provider**: [Transleti](https://transleti.com)
* [Transleti Terms of Service](https://transleti.com/terms/)
* [Transleti Privacy Policy](https://transleti.com/privacy/)

== Installation ==

1. Upload the `transleti-connector` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **Settings > Transleti**.
4. Select your multilingual plugin (TranslatePress or WPML).
5. Enter your Transleti API key ([get one at transleti.com](https://transleti.com)).
6. Save settings. Translations will begin automatically on the next cron run.

== Frequently Asked Questions ==

= Do I need an API key to use this plugin? =

Yes. You need a Transleti API key to use the translation service. Visit [transleti.com](https://transleti.com) to get your API key with a flat monthly subscription — unlimited translations included.

= Which multilingual plugin do I need? =

You need either **TranslatePress** (free version works) or **WPML** with the String Translation addon. Transleti detects which one is active and adapts automatically.

= How many languages can I translate to? =

LibreTranslate supports 29 languages. You can translate to all of them simultaneously.

= Will it translate my Elementor / Gutenberg pages? =

Yes. Transleti has specialized parsers for both Elementor and Gutenberg content. It detects page builder content automatically and translates text elements while preserving the layout structure.

= What happens if I manually edit a translation? =

Transleti detects manual edits and preserves them. When re-translation is triggered (e.g., you update the original post), only the segments you haven't manually edited will be re-translated.

= Does it translate WooCommerce products? =

Yes. Products, variations, categories, tags, and attributes are all translated. It also works with WooCommerce-compatible plugins like JustTables Pro.

= Can I protect certain words from being translated? =

Yes. The **Do Not Translate** feature lets you list words and phrases (one per line) that should never be translated — perfect for brand names and technical terms.

= Is it compatible with SEO plugins? =

Yes. Transleti translates `post_title` which is used by SEOPress, Yoast SEO, and AIOSEO for meta titles. Your translated pages will have proper SEO titles in every language.

= What happens with untranslated pages? =

Untranslated pages return a SEO-safe 503 status code with a Retry-After header. Search engines understand this means "come back later" and won't deindex the URL or index mixed-language content. Visitors see a friendly page in their language with options to go to the homepage or view the original version.

= My theme doesn't display translations correctly. Can you help? =

Yes. Go to **Settings > Transleti > Support** and send a diagnostic report. If a specific page has issues, enter its URL to include a detailed content comparison. Our team will analyze the report and work on resolving the theme compatibility issue.

== Screenshots ==

1. Settings page — configure your multilingual plugin and LibreTranslate server.
2. Translation Dashboard widget — track translation progress per language.
3. Do Not Translate — protect brand names and technical terms.

== Changelog ==

= 1.9.1 =
* Added grupobouso as contributor.

= 1.9.0 =
* Fixed critical wp-cron compatibility issue: batch translator now works reliably in all hosting environments.
* Fixed TranslatePress machine translator initialization in wp-cron context where TRP returns base class instead of LibreTranslate engine.
* Added safety fallback with proper settings merge (trp_settings + trp_machine_translation_settings) when creating translator instance.
* Added method_exists() checks for get_engine_specific_language_codes() to prevent fatal errors with custom TRP configurations.
* Updated FAQ page content on transleti.com.

= 1.8.9 =
* Added remote diagnostic report system: one-click report from Settings > Transleti > Support.
* Added post inspection: include detailed content comparison (original vs. translated) for a specific page.
* Added SEO-safe 503 page for untranslated content with Retry-After header for search engines.
* Fixed 503 template URL generation for TranslatePress: now reads URL slugs from TRP settings instead of raw locale codes.
* Fixed 503 template for sites where default language has no URL subdirectory.
* Added external service disclosure for diagnostic report submissions.

= 1.8.8 =
* Improved translation dashboard: excluded admin-only string contexts from percentage calculations.
* Fixed untranslated page titles (Home, FAQ, Checkout) that LibreTranslate returned unchanged.
* Added title protection to prevent cron from overwriting manually translated titles.
* Improved Elementor page detection in untranslated content checks.
* Added deploy tool for WordPress.org SVN repository management (development only).

= 1.8.7 =
* Added HTML entity and shortcode protection for LibreTranslate translations.
* Entities like &copy; &#8217; &hellip; are now preserved through translation.
* WordPress shortcodes of any type are protected from corruption during translation.
* Auto-resolve numeric-only dictionary entries (pagination, form values) without calling LibreTranslate.
* Fixed stuck dictionary entries for certain languages caused by character length filter.

= 1.8.6 =
* Fixed inline JavaScript and CSS to use WordPress enqueue system (wp_enqueue_script, wp_add_inline_style).
* Renamed all internal prefixes from trp_lt_ to transleti_ to avoid naming collisions.
* Added automatic migration for existing settings when upgrading.
* Added full external services documentation to readme.
* Improved code quality for WordPress.org repository compliance.

= 1.8.5 =
* Ported retry mechanism and long text chunking from WPML to TranslatePress batch translator.
* Added time budgeting to prevent cron timeouts.
* Improved crawl speed: moved crawl to first phase, increased batch size.

= 1.8.2 =
* Fixed SVGs disappearing from translations due to WPML sync_with_duplicates overwriting content.
* Prevented WPML save_post hooks from interfering during translate_post() operations.
* Title/excerpt translation failure no longer aborts entire post translation (content continues).
* Source post changes now trigger clean re-translation (reset translation meta for fresh start).

= 1.8.1 =
* Fixed WPML string translations not appearing on frontend (MO file regeneration).
* Added automatic MO file integrity check after batch string translation.
* Ensures translations survive language deletion and re-activation in WPML.

= 1.8.0 =
* Added "Do Not Translate" word list to protect brand names and technical terms.
* Fixed SVG icons disappearing from Gutenberg translations (generateblocks/text blocks).
* Added direct database save after wp_update_post to prevent WPML hook interference.
* Added SVG preservation in link-fixing phase (Phase 8).
* Added menu icon meta copying for Menu Icons plugin compatibility.
* Added JustTables Pro WPML string translation bridge.

= 1.7.8 =
* Fixed SQL query bug with empty string comparisons in TranslatePress mode.
* Improved cron scheduling with self-sustaining mechanism.
* Moved crawl phase after translation to prioritize actual translations.

= 1.7.2 =
* Improved manual edit protection: reversion detection and 80% threshold.
* Fixed WPML duplication issue: detect untranslated duplicated posts.
* Added WP-Cron resilience with multiple scheduling hooks.

= 1.7.0 =
* Added API key validation and subscription management.
* All translation entry points gated by API key check.
* Auto-activation on settings save.
* Admin notices for key status (missing, invalid, expired, domain mismatch).

= 1.5.0 =
* Added manual edit protection: stores auto-translation segments and preserves human edits.
* Added Elementor dynamic text detection (works with any addon).
* Added Gutenberg block attribute translation (Spectra, Kadence, GenerateBlocks).

= 1.2.0 =
* Unified TranslatePress and WPML support via Multilingual Detector.
* Added 8-phase batch translator for WPML mode.
* Added slug translation for both TranslatePress and WPML.
* Added menu translation for WPML.

= 1.0.0 =
* Initial release with TranslatePress support.
* LibreTranslate API integration.
* Automatic batch translation via WordPress cron.

== Upgrade Notice ==

= 1.8.6 =
Improved WordPress.org repository compliance. All settings are automatically migrated.
