=== SiteLang ===
Contributors: sitelang
Tags: woocommerce, multilingual, translation, language switcher, internationalization
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Translate content locally with language URLs, manual editing, switchers, SEO tools, and WooCommerce support.

== Description ==

SiteLang stores translated content as linked WordPress records in your existing site. Added languages use URL prefixes such as `/de/`; your original language stays at the root. WooCommerce is optional for the core plugin and is needed only for product-specific tools and Merchant Center feeds.

Included local features do not expire and have no plan quotas. Disconnecting SiteLang or ending a service subscription does not hide or delete local translations. The optional managed AI gateway is a paid service; it is not an OpenAI key proxy and does not store provider credentials in WordPress.

The plugin is an independent project and is not affiliated with or endorsed by WooCommerce or Automattic.

Local SiteLang features have no plan quotas. Optional SiteLang Growth and Pro paid access provide managed AI service allowances only; they do not unlock code or limit local plugin features. Paid plans are sold through the SiteLang storefront. Plan price, term, billing interval, payment method, renewal, cancellation, and refund information are shown at checkout and described in the [Terms of Sale](https://sitelang.pro/terms/). Recurring plans renew at the interval shown at checkout until canceled; one-time orders do not renew. The payment provider shown at checkout processes payment details under its own terms and privacy policy. SiteLang receives the order, plan, billing contact, and transaction or subscription status needed to provision and maintain service access. The [Privacy Policy](https://sitelang.pro/privacy/) describes service and billing data use.

= External services =

SiteLang's hosted service at [service.sitelang.pro](https://service.sitelang.pro) provides optional account activation, plan validation, and managed AI translation. Local languages, manual translation, URLs, switchers, and other included local tools work without it. Plugin activation does not contact the service. An administrator can click "Load current plans" in SiteLang > License before connecting an account; this fetches the public plan catalog without sending site, account, or translation fields. The service may still receive ordinary network information such as the server IP address.

Only after an administrator enters an activation code and account email and accepts the service disclosure does SiteLang send the code and email they entered, the site URL and name, plugin version, and a SHA-256 hash of the site URL to the hosted service. While connected, an authenticated background request about every ten minutes sends the site URL, name and hash; plugin, WordPress, WooCommerce and PHP versions; locale; enabled-language and mapped-content counts; queued-job count; applied license revision; a safe last-error code; and acknowledged service-command identifiers. The request also carries the installation identifier and site token in authentication headers. It does not send translation content. When an administrator disconnects, the plugin sends an authenticated release request for that installation with no content or account fields in its body, then clears its local token and stops future heartbeats. SiteLang stores account, installation, order, and operational records as explained in its [Terms of Sale](https://sitelang.pro/terms/) and [Privacy Policy](https://sitelang.pro/privacy/).

When a connected administrator requests managed AI translation, the selected source text and protected markup, translation instructions, source and target languages, model, and generation options are sent to SiteLang over HTTPS. SiteLang forwards the authorized translation request to OpenAI for translation and returns the result to this WordPress site. OpenAI receives that selected content and request context only when managed AI is used; the provider API key stays on SiteLang's server. See OpenAI's [Service Terms](https://openai.com/policies/service-terms/) and [Privacy Policy](https://openai.com/policies/privacy-policy/). SiteLang's application schedules deletion of its AI usage records, including completed responses, after 30 days; provider records, backups, and operational logs can follow different schedules described in the applicable policies. Review content before sending personal or sensitive information.

The hosted service is operated by SiteLang. Its [Terms of Sale](https://sitelang.pro/terms/) describe paid plans, payment, renewal, cancellation, and refunds. Its [Privacy Policy](https://sitelang.pro/privacy/) describes account, service, translation, and billing data use and retention. Storefront payment options and terms can change; review the current pages and checkout before purchasing.

== Installation ==

1. Upload the `sitelang` folder to `/wp-content/plugins/` or install the ZIP through Plugins &gt; Add New Plugin &gt; Upload Plugin.
2. Activate **SiteLang**.
3. Open **SiteLang &gt; Languages**, choose a default language, and add target languages. No account or activation code is needed for local features.
4. Open **SiteLang &gt; Translations** to create a linked draft. Edit the translated WordPress record, mark it complete, and publish it when ready. Product translations remain drafts for review.
5. Place the switcher with the `[sitelang_switcher]` shortcode, SiteLang Switcher block, Elementor widget, supported theme hook, or `sitelang_wc_switcher()` helper.
6. To use managed AI, connect an account from **SiteLang &gt; License**. Read and accept the service data disclosure before activation. An eligible paid service allowance is required for AI requests; provider credentials remain on the service.

== Frequently Asked Questions ==

= Does local translation require an account or paid plan? =

No. Language management, manual linked translations, URLs, switchers, menus, local SEO output, sitemaps, feeds, internal links, and XLIFF work without a SiteLang account. Locally included code does not have plan quotas.

= What stops working if I disconnect or my subscription ends? =

Managed AI requests stop when the account is disconnected, the service is unavailable, or the plan no longer includes the requested operation. Saved translations, their public URLs, and local features remain available.

= Does paid access automatically renew? =

Recurring plans renew at the interval displayed at checkout until canceled. One-time orders do not renew. Use the payment provider's receipt or account portal for cancellation instructions, and review the current Terms of Sale for refund and statutory-rights information. The hosted service updates plan access from the order and subscription status it receives.

= What content is sent for managed AI translation? =

The selected source fields, protected markup/structure, language instructions, model and generation settings are sent to SiteLang, which forwards the authorized request to OpenAI. SiteLang AI usage/idempotency rows, including translated responses, are scheduled for deletion after 30 days. Provider, infrastructure-log, backup, and support-record retention may differ; review the linked SiteLang and OpenAI policies before submitting personal or sensitive content.

= Does this plugin send analytics or contact a licensing server on activation? =

Plugin activation itself makes no network request. Account activation is initiated by an administrator after consent. If connected and consent remains saved, the plugin sends one authenticated heartbeat every ten minutes; this response also supplies signed entitlements, so there is no separate scheduled entitlement request. Disconnecting clears consent and stops further account heartbeats. There are no private plugin update checks; WordPress.org supplies plugin updates.

= Is WooCommerce required? =

No. WordPress pages, posts, languages, switcher, routing, SEO, sitemap, and XLIFF features work without WooCommerce. Product translation and merchant feed features require WooCommerce.

= What happens to existing plugin translations when upgrading? =

Existing language settings, mapping rows, translated posts/products, XLIFF data, and license settings are preserved. Plan locks are removed, so translations previously hidden by a plan or expired service become available again. Private plugin update metadata is no longer used; future code updates for this plugin come from WordPress.org.

== Privacy ==

SiteLang adds suggested privacy-policy text under Settings &gt; Privacy. Local features do not transmit content to SiteLang. On WooCommerce sites, the plugin may set a functional language-preference cookie for up to one month after a visitor chooses a language, so cart and account links remain in that language; its value is validated against enabled languages. Optional hosted service use is described under External services above and in SiteLang's [Privacy Policy](https://sitelang.pro/privacy/).

== Source and licensing ==

PHP, CSS, and JavaScript files in this package are included as human-readable source; no build/minification step is required. The package contains no bundled third-party runtime library, web font, or icon font. Admin icons use WordPress Dashicons. The bundled flag SVGs include MIT-licensed flag-icons and Circle Flags artwork; their copyright and license notices are included in `assets/flags/licenses/flag-icons-MIT.txt` and `assets/flags/licenses/circle-flags-MIT.txt`. Plugin code is licensed GPL-2.0-or-later.

== Changelog ==

= 1.1.8 =
* Align checkout, payment, and recurring-plan disclosures with the current live Terms of Sale and Privacy Policy.

= 1.1.7 =
* Align the SiteLang service disclosure with the current one-time, manually confirmed test checkout and its Terms of Service.
* Harden the outbound-request test fixture against direct access and clean up directory-package review findings.

= 1.1.6 =
* Render first-run setup directly when Overview is opened, avoiding redirect failures if headers were sent.

= 1.1.5 =
* Redirect directly to first-run setup after activation when setup is incomplete.

= 1.1.4 =
* Always route incomplete first-run setup from the top-level SiteLang menu.
* Keep configured languages from silently marking setup complete.

= 1.1.3 =
* Open first-run setup from the SiteLang menu, with an explicit skip option.
* Return to the Overview after setup is completed or skipped.

= 1.1.2 =
* Document SiteLang and OpenAI service use with public Terms and Privacy links.
* Load admin scripts through WordPress's enqueue system and review request permissions.

= 1.1.1 =
* Use the SiteLang directory slug for the package folder, main file, and translation text domain.
* Keep existing settings, content mappings, service identifiers, and WooCommerce integration behavior unchanged.

= 1.1.0 =
* Show translated Elementor sections in manual translation previews when their matching page-content fields are edited.
* Preserve Elementor markup and directly edited Elementor fields in those previews and published translations.

= 1.0.80 =
* Fix manual translation previews so they resolve to the selected translated draft.
* Fix switcher links so returning to the default language does not inherit the current language prefix.

= 1.0.79 =
* Verify the manual editor nonce directly in save and autosave handlers before loading translation data.
* Validate Elementor language input and the numeric managed-translation temperature at their request boundaries.

= 1.0.78 =
* Keep URLs, shortcodes, placeholders, entities, and symbol-only fragments unchanged in structure-safe fallback translation.
* Retry empty visible-text fragment responses once and fail clearly if content is still omitted.

= 1.0.77 =
* Add a structure-safe fallback that translates visible-text fragments separately when a model changes protected markup sentinels.
* Rebuild and validate the original HTML, block comments, and entities locally before saving.

= 1.0.76 =
* Use distinct opaque sentinels for protected HTML and WordPress block markup so managed translation preserves them more reliably.
* Clarify sentinel preservation in structured and fallback translation requests while retaining strict local structure validation.

= 1.0.75 =
* Complete the local manual translation editor in the WordPress.org package.
* Keep all local translation functionality available without an account, activation code, or quota.
* Use one consent-gated ten-minute heartbeat to refresh cached signed entitlements.
* Clarify managed AI data flows and 30-day application retention.
* Clarify that staging checkout is not an automatic recurring subscription.

= 1.0.74 =
* Align the plugin plan display with the Laravel owner's single managed-AI plan catalog.
* Keep plan discovery an administrator-triggered public catalog request that sends no site, account, or translation data.
* Remove the account activation overlay from the license page; service connection is optional and local setup stays accessible.
* Publish AI-only plan entitlements and enforce monthly AI token allowances in the hosted service.
* Keep all local translation, language, URL, SEO, WooCommerce, feed, and XLIFF features free of plan limits.

= 1.0.73 =
* Make local languages, manual translations, and included local tools available without an account or plan quota.
* Keep published translations available after account disconnection, downgrade, expiration, or service outage.
* Remove private update metadata and downloads; WordPress.org is the plugin update source.
* Require explicit service disclosure consent for account activation and subsequent service heartbeats.
* Add a WordPress privacy-policy suggestion and WordPress.org readme.
* Declare WooCommerce HPOS compatibility based on order-data API audit; no WooCommerce version is claimed as tested in this package.

= 1.0.72 =
* Previous development release.
