=== Deepglot ===
Contributors: helpstring
Tags: translation, multilingual, language switcher, localization, ai translation
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 0.12.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Translate WordPress with AI, SEO-friendly language URLs, hreflang, sitemaps, and a flexible language switcher.

== Description ==

Deepglot turns one WordPress site into a multilingual experience without duplicating posts or rebuilding pages. It translates the rendered output, keeps your source content in place, and serves visitors language-specific pages with the SEO signals search engines expect.

A Deepglot account and API key are required. Connect a hosted project at https://deepglot.ai or use a compatible self-hosted Deepglot service.

= Publish in more languages from one WordPress site =

* Translate visible text, metadata, accessibility attributes, and JSON-LD structured data.
* Keep the original posts and pages as the single source of truth.
* Rewrite internal links and translated URL slugs with path-prefix or subdomain routing.
* Translate supported WooCommerce email subjects, headings, and HTML content when enabled.

= Build multilingual SEO into every page =

* Add reciprocal canonical, `hreflang`, and `x-default` links.
* Publish a dedicated multilingual sitemap with alternate-language entries.
* Redirect stale translated slugs to their current localized URLs.
* Serve cached translations to crawlers without spending fresh translation quota.

= Put the language switcher where it belongs =

Add Deepglot through a shortcode, block, widget, navigation menu, theme action, or automatic placement. Choose a list or dropdown, labels or ISO codes, flag styles, language order, device visibility, and inline or floating positioning. Multiple independent switcher instances let different parts of the site use different presentations.

= Keep the visitor experience responsive =

Deepglot stores translations locally. Uncached text is queued for an immediately due background WP-Cron job, so ordinary page requests do not wait for a slow translation provider. After warming succeeds, Deepglot purges affected URLs in WP Rocket, W3 Total Cache, LiteSpeed Cache, and WP Super Cache.

For AJAX, infinite-scroll, and other content added after page load, an optional same-origin REST flow can translate new text without exposing the API key to the browser.

= Stay in control =

Exclude URLs, selectors, or regular-expression patterns from translation. Use synchronized translated slugs and manual translations from the Deepglot project. Enable browser-language redirects, search, AMP, dynamic content, and WooCommerce email translation only when they fit your site.

Deepglot is GPL-licensed. Development source and reproducible release build instructions are available at https://github.com/ostheimer/deepglot.

== Installation ==

1. Install Deepglot from `Plugins -> Add New`, then activate it.
2. Create a Deepglot project and copy its API key.
3. Open `Settings -> Deepglot` and connect the project.
4. Choose the source language, target languages, routing, switcher, and exclusions.
5. Make sure WP-Cron or the host's system cron is running so uncached translations can warm in the background.

== Screenshots ==

1. A real Deepglot frontend switcher with four languages, circular flags, and floating placement.
2. Connect a project and configure source and target languages in the three-step setup.
3. Choose the switcher presentation, flag style, labels, devices, breakpoint, and page position.
4. Reorder languages, provide optional custom flags, and add independent switcher instances.

== Frequently Asked Questions ==

= Do I need a Deepglot account? =

Yes. Use an account at https://deepglot.ai or configure a compatible self-hosted Deepglot service.

= Does the plugin duplicate posts? =

No. Translation happens on rendered output. Source content remains in the original WordPress posts and pages.

= What happens when the quota is exhausted? =

Cached translations remain available. Uncached content falls back to the source language, and administrators see a quota notice.

= Why can the first translated page view still show the source language? =

Since version 0.12.0, ordinary page requests do not wait for a slow translation provider. The first view queues uncached text for an immediately due WP-Cron job. After the job succeeds, Deepglot stores the translations locally and purges affected URLs in WP Rocket, W3 Total Cache, LiteSpeed Cache, and WP Super Cache. If later views remain in the source language, verify that WP-Cron or the host's system cron is running and purge any other page-cache plugin manually.

== External services ==

By default, this plugin connects to the Deepglot service at `https://deepglot.ai/api/`. A compatible self-hosted API base URL can be selected in the settings.

For translation requests, the plugin sends the configured API key, text fragments from rendered pages, source and target language codes, the requested page URL, and a bot-classification code. It sends these requests when uncached content needs translation or when an administrator tests the connection. Dynamic translation requests first pass through the site's same-origin WordPress REST endpoint, so the API key is not exposed to browsers.

Settings synchronization sends the configured API key, site URL, routing mode, source and target languages, domain mappings, and the feature flags for automatic redirect, email translation, search translation, AMP translation, and dynamic translation.

Runtime refresh sends the configured API key and receives URL and selector exclusions, regular-expression exclusions, and translated URL-slug mappings. The plugin can also request the public supported-languages list without an API key.

Starting the Visual Editor verifies its token through the project-scoped `editor-sessions/verify` endpoint. Saving a manual translation sends the token, original and translated text, source and target language codes, and the request URL to the project-scoped `manual-translations` endpoint.

Deepglot returns translated text, language and quota status, and the synchronized project configuration described above. Review the service policies before enabling the hosted service:

* Terms of service: https://deepglot.ai/terms
* Privacy policy: https://deepglot.ai/privacy

== Changelog ==

= 0.12.2 =
* Uses the WordPress 6.9 template enhancement buffer and explicitly closes the legacy fallback buffer on older supported WordPress versions.
* Uses uniquely prefixed translation transients and keeps legacy Yoast compatibility without declaring a Deepglot-owned global.

= 0.12.1 =
* Removed arbitrary custom CSS input from language-switcher settings and runtime configuration.
* Loaded admin and nav-menu assets through WordPress enqueue APIs and attached generated responsive and flag rules through the registered switcher stylesheet.

= 0.12.0 =
* Ordinary page rendering no longer waits for fresh translations. Uncached segments are translated by a background job, so the first cold view is fast and later views converge after WP-Cron succeeds.
* Added bounded, atomically locked background cache warming. Failed and partial results remain queued, and supported full-page caches are purged after warming completes.
* Kept visual-editor previews and WooCommerce HTML emails synchronous because those one-off outputs cannot converge on a later page request.
* Added the `deepglot_max_sync_batches` filter to translate inline again on fast providers, and `deepglot_api_timeout` to tune the request budget.

= 0.11.7 =
* Added a fail-safe final translated-HTML filter for trusted site-specific localization such as language-specific media embeds.

= 0.11.6 =
* Split content-heavy cold pages into ordered parallel requests bounded by 2,000 UTF-8 source bytes and 200 strings.

= 0.11.5 =
* Extended the bounded translation request window to 60 seconds so valid cold large-page batches do not fall back to untranslated content.

= 0.11.4 =
* Preserved numeric-looking source-slug mappings after persistence so existing translated routes remain resolvable.

= 0.11.3 =
* Hardened reciprocal canonical, hreflang, and multilingual sitemap output across source and translated routes.
* Redirected stale translated slugs to current localized URLs, preserved semantic query routing, and suppressed source-only Avada AJAX suggestions on target-language pages.
* Allowed 30 seconds for translation batches and rejected malformed provider responses instead of accepting partial results.

= 0.11.2 =
* Detected a revoked or invalid API key (HTTP 401) and stopped retrying it on every page view.
* Added a wp-admin error notice and an "API-Key ungültig" settings status instead of a misleading active state.
* Cleared the invalid-key state immediately when a new API key or backend URL is saved.

= 0.11.1 =
* Preserved whitespace-prefixed `mailto:` and `tel:` action links during URL rewriting.
* Restored full-language descriptions when the switcher displays ISO-code labels.
* Cleared WordPress.org Plugin Check errors for URL parsing, direct access, escaping, and translator comments.

= 0.11.0 =
* Added SaaS-managed translated URL slugs for forward and reverse request routing.
* Added bounded runtime-config refresh and dedicated persisted slug mappings.
* Excluded WordPress infrastructure paths from translation routing.
* Added the refreshed Deepglot admin branding, packaged logo, and orange visual-editor accents.
* Updated dashboard links and localized setup copy from deepglot.app to deepglot.ai.

= 0.10.4 =
* Prevented intermediary caches from preserving stale virtual `robots.txt` responses.

= 0.10.3 =
* Kept multilingual sitemap discovery when late renderers such as Yoast SEO replace `robots.txt` output.

= 0.10.2 =
* Preserved raw UTF-8 through DOM serialization, including emoji and umlauts in scripts and styles.

= 0.10.1 =
* Excluded switcher CSS from WP Rocket used-CSS and minification pipelines.

= 0.10.0 =
* Added independent switcher instances, templates, visual placement, AMP handling, and a multilingual sitemap.

== Upgrade Notice ==

= 0.12.2 =
Closes the complete response-buffer lifecycle and strengthens unique naming for WordPress.org compatibility. Requires PHP 8.0 or newer.

= 0.12.1 =
Addresses WordPress.org review feedback by removing arbitrary CSS input and loading plugin assets through WordPress APIs. Requires PHP 8.0 or newer.

= 0.12.0 =
Moves fresh translations off the page render into a background job, so cold pages load fast instead of waiting for the translation API. Requires PHP 8.0 or newer.

= 0.11.7 =
Allows trusted site-specific callbacks to localize media embeds after the full translation pipeline. Requires PHP 8.0 or newer.

= 0.11.6 =
Prevents content-heavy cold pages from exceeding the translation window as one oversized provider request. Requires PHP 8.0 or newer.

= 0.11.5 =
Allows cold large-page translations up to 60 seconds to complete instead of returning partially untranslated pages. Requires PHP 8.0 or newer.

= 0.11.4 =
Preserves translated routes whose source slug consists only of digits. Requires PHP 8.0 or newer.

= 0.11.3 =
Hardens localized SEO metadata and slug canonicalization, preserves search routing, and allows longer translation batches. Requires PHP 8.0 or newer.

= 0.11.2 =
Reports an invalid or revoked API key in wp-admin and stops re-sending doomed translation requests on every page view. Requires PHP 8.0 or newer.

= 0.11.1 =
Preserves action links, restores descriptive ISO-code labels, and improves WordPress.org compatibility. Requires PHP 8.0 or newer.
