=== Transglot ===
Contributors: transglot
Tags: multilingual, translation, localization, hreflang, multilanguage
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Translate posts, pages and terms, serve them on per-language URLs with correct hreflang, and keep every translation in your own database.

== Description ==

Transglot connects your site to a Transglot project, publishes reviewed translations back into WordPress, and serves them on real per-language URLs.

Translations are stored in your site's own database, as post meta and as compiled files in your uploads directory. They are yours. If your subscription ends, if your API token is revoked, or if the API is unreachable, the following keep working exactly as before:

* language routing and per-language URLs
* rendering translated titles, content, excerpts, terms and media alt text
* hreflang annotations and per-language sitemaps
* the language switcher in all six placements
* export to XLIFF and PO

What a subscription pays for is new automatic translation and new pushes of your site's strings. It does not gate anything already in your database.

**What it translates**

* Posts, pages and any custom post type the connection is configured for
* Categories, tags and custom taxonomy terms
* Theme and plugin interface strings, read from the .pot and .po files they already ship
* Menu labels, widget text, site title and tagline
* Media alt text, captions and titles
* Titles and meta descriptions from Yoast SEO, Rank Math, SEOPress and All in One SEO
* Advanced Custom Fields text, textarea, wysiwyg and repeater subfields
* WooCommerce product name, description and short description (see the FAQ for what is not covered)

**URLs and SEO**

Language is resolved from the URL and from nothing else, so each language is a separate cacheable page for WP Rocket, LiteSpeed, W3TC and Cloudflare. Four URL modes are available: subdirectory, query parameter, subdomain and separate domain. Subdomain and domain modes run a preflight and refuse to activate until the host answers.

One component emits hreflang, and you choose which. The setting is Transglot, your SEO plugin, or neither. The built-in inspector fetches your own live URLs and reports what actually renders: missing return links, targets that do not match their canonical, bare language codes where a full locale is required, a missing x-default, and a second emitter.

**Setup**

Paste an eight-character code from your Transglot project. The plugin mints its own WordPress application password through WordPress's own authorization screen, pairs, registers the translation meta, and then runs a self-test that writes a bundle through the same REST route the server uses and reads it back. The last screen of the wizard says whether the round trip works, not whether a form submitted.

**Source and build instructions**

The source for the block editor and the bundled visual editor is included in this plugin's source/ directory. See source/README.txt for the build instructions and dependency licenses. No access to a private repository is required.

**Migrating from Polylang**

The Polylang importer reads Polylang's own taxonomies and reports, before it writes anything, exactly what will and will not carry over, row by row. It never deletes Polylang's data.

**A Transglot account is required**

Automatic translation runs on Transglot's servers. Using those features requires a Transglot account, which is a separate paid service. See the External services section below for exactly what is sent and when.

== External services ==

This plugin connects to the Transglot API at `api.transglot.ai`, and, only when you switch the optional in-context editor on, to the Transglot app at `app.transglot.ai` from the browser of a signed-in editor. It does not connect to any other third-party service, and it loads no JavaScript, CSS, fonts or images from any remote host: everything the admin screens and the in-context editor use ships inside this plugin.

**When the plugin sends data to api.transglot.ai**

1. **Pairing**, once, when you paste a pairing code. Sent: the code, your site URL and home URL, the WordPress application password the plugin minted for the connection, the content types and fields you selected, and diagnostics used only for display and support (WordPress version, PHP version, plugin version, permalink structure, REST prefix, whether the site is multisite, which SEO plugin is active, whether WooCommerce is active, and your timezone offset).
2. **Content change notifications**, when a post, page or term is created, updated, unpublished, trashed or deleted. Sent: a list of content type and numeric id pairs. No content is sent in this request. Transglot then reads the changed entries back over your site's REST API using the credential from step 1.
3. **String pushes**, when you run a scan or when a theme or plugin version changes. Sent: the source-language text of the interface strings collected from your site, with the file reference and text domain they came from.
4. **Bundle and status reads**, on a schedule and on demand. Sent: your API token. Received: your translations and the status of the last publish.
5. **Health reports**, after a self-test. Sent: whether the round trip verified, the reason if it did not, the last notification status, and the plugin version.
6. **In-context editing sessions**, only when you switch the in-context editor on and only for a signed-in user who holds the permission to edit that language. Your site sends your API token and the list of translation keys the session may change, and receives a single-use session token. The editor bundle itself is loaded from this plugin, never from a remote host; while a reviewer is editing, their browser reads and writes those translations directly with `app.transglot.ai`.

Nothing is sent to Transglot until you complete pairing. Site visitors' data is never sent.

Terms of Use: https://transglot.ai/legal/terms
Privacy Policy: https://transglot.ai/legal/privacy

== Installation ==

1. Install and activate the plugin.
2. Open Transglot in the WordPress admin menu.
3. Paste the eight-character pairing code from your Transglot project.
4. Choose your languages and a URL mode. The preflight runs inline and tells you if the mode cannot work on this site.
5. Place the switcher.

The wizard ends with the round-trip verdict. If it says the round trip is broken, it names the cause.

== Frequently Asked Questions ==

= Can I change the language switcher's appearance? =

Yes. In Transglot settings, open Language switcher to choose a light theme, a dark theme or the visitor's device preference. Place it in a floating corner or in a footer bar, and show or hide flags. The live preview updates before you save.

Choose manual placement to add a block, widget, shortcode or template switcher yourself. Blocks and shortcodes can override the site's theme; for example, [transglot_switcher theme="dark" show_flags="0"].

= What happens to my translations if I cancel? =

They stay in your database and keep rendering. Routing, hreflang, sitemaps, the switcher and export do not check for a licence. Cancelling stops new automatic translation and new string pushes.

= Can I export my translations? =

Yes, to XLIFF 1.2 and to PO, from the Export screen, with no token and with an expired subscription. The export reads your local database.

= Does it work with Yoast SEO or Rank Math? =

Yes. The plugin detects which SEO plugin is active and which annotations it is emitting. You choose one hreflang authority, so the page never carries two conflicting sets. Per-post titles and meta descriptions are translated through each plugin's own output filter.

= Does it add database tables? =

No. Translations live in post meta and term meta. Interface strings are compiled to PHP files in `wp-content/uploads/transglot/bundles/`, read with one include and one array lookup, which is zero database queries per string. The Storage screen shows exactly how many bytes each of these uses and lets you prune orphaned rows.

= Does it work with caching plugins? =

Yes. Language is resolved from the URL only, never from a cookie or a session, so each language is a separate cache entry. The plugin detects WP Rocket, LiteSpeed, W3TC and Cloudflare and offers the configuration each one needs.

= Is WooCommerce supported? =

Product name, description and short description are translated and rendered. Variations, product attributes, per-currency prices, checkout and store emails are not translated in this version. The plugin says so once, in the admin, rather than letting you find out at checkout.

= Does it work on multisite? =

Not in this version. Network activation is refused with an explanation. Activate it per site.

= Can I use it alongside WPML, Polylang or TranslatePress? =

No. Two plugins filtering `home_url`, `the_content` and `locale` at the same time produce incoherent output, so the routing layer refuses to run when another multilingual plugin is active. There is an importer for Polylang.

= Which capabilities does it add? =

`transglot_manage` for settings and pairing, `transglot_manage_languages`, `transglot_translate`, and `transglot_edit_translations_{locale}` for each language. Administrator gets all of them and Editor gets the translation ones. `manage_options` is not reused, so you can give a translator one language without giving them the site.

= What is removed when I uninstall? =

Options, transients, capabilities, scheduled events, the compiled bundle directory and the plugin's own per-language override meta. The translations published by the connector are kept unless you tick the box on the settings page first. The uninstaller reports what it removed.

== Screenshots ==

1. Get started in minutes: install the plugin, connect your project, then choose your languages and switcher style.
2. Your website, their language: a working switcher on a sample travel journal with French content.
3. Your switcher, your style: light and dark themes, floating or footer placement, and optional flags.
4. The WordPress appearance settings, with a live preview before you save.
5. Manage English, French and Arabic from the WordPress admin.
6. The same sample travel journal in Arabic, with right-to-left content and a footer switcher.

== Changelog ==

= 0.1.0 =
* First release.
* Registers the translation meta key for every paired post type and taxonomy, and verifies the round trip against the real REST route.
* Language routing in four URL modes, each with a preflight.
* Rendering for post fields, block content, terms and media alt text, resolved per field.
* hreflang with a single explicit authority, canonical, and per-language sitemaps.
* Language switcher in six placements, including a server-rendered block.
* Theme and plugin string translation from the .pot and .po files they ship, compiled to PHP with zero queries per string.
* Batched, signed content change notifications with two independent loop guards.
* Pairing from one eight-character code, with no credential, URL, secret or code snippet typed by hand.
* Polylang importer with a dry-run report.
* Export to XLIFF 1.2 and PO, with no token required.
* WP-CLI commands, with language as an explicit parameter that defaults to all languages.
* A documented `transglot/v1` REST namespace.

== Upgrade Notice ==

= 0.1.0 =
First release.
