=== AI Product Translator for CJDropshipping ===
Contributors: radilov
Tags: cj dropshipping, translation, polylang, woocommerce, multilingual
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically translates CJDropshipping products into all your Polylang languages, keeping the shared SKU intact.

== Description ==

Dropshipping stores fed by CJDropshipping receive their products in English. This plugin detects every product CJ creates through the WooCommerce API and automatically creates linked Polylang translations in every language of your store — title, short and long description, and optionally category, tag and attribute names.

The critical part for dropshipping: **the SKU of every product and variation is shared between translations** (through the woo-poly-integration plugin), so CJDropshipping keeps matching order items by SKU no matter which language your customer bought in. Stock, prices, images and variations are shared too.

**Features**

* Detects products created by CJ through the WooCommerce API (legacy `wc-api/v3` and modern REST), plus the WooCommerce CSV importer.
* Waits a configurable delay so CJ finishes uploading variations and images, then translates in the background (WP-Cron).
* Creates linked Polylang translations sharing SKU, stock, prices, images and variations.
* Optionally translates category, tag and attribute term names, creating linked term translations.
* Bulk-translate your existing catalogue: one button for everything pending, or a bulk action in the products list.
* Activity log with errors and retries.

**Plans**

Translations are performed by the Asperor translation service (see "External services" below). The free plan includes up to 10 products per site, translated into every language of your store. Unlimited translation requires a paid license from [asperor.com](https://asperor.com/ai-product-translator/).

**Requirements**

* WooCommerce
* Polylang (free version is enough) with your languages configured
* [Hyyan WooCommerce Polylang Integration](https://github.com/hyyan/woo-poly-integration) (woo-poly-integration) — used to duplicate variations and share SKUs

== External services ==

This plugin connects to the Asperor translation API (`https://asperor.com/apt-api/`), operated by the plugin author, to perform the translations.

* **What is sent:** your site URL (on connection), the product texts to translate (title, descriptions, category/tag/attribute names), the source and target language, an internal product ID (for the free-plan quota) and, on paid plans, your license key.
* **When:** only after you explicitly connect the site from the settings page, and then each time a product is translated.
* **Why:** the service performs the machine translation and enforces the plan quota.

The service uses Google Gemini as the underlying AI translation provider, so the submitted texts are also processed by Google ([privacy policy](https://policies.google.com/privacy)). Service terms and privacy policy: [asperor.com/ai-product-translator](https://asperor.com/ai-product-translator/).

No data is sent anywhere until you press "Connect this site" on the settings page.

== Installation ==

1. Install and activate WooCommerce, Polylang (with your languages configured) and woo-poly-integration.
2. Install this plugin and activate it.
3. Go to WooCommerce → AI Translator and press "Connect this site" (free plan, 10 products).
4. Done: every product CJ pushes to your store gets translated automatically. For the existing catalogue use "Translate all pending".

== Frequently Asked Questions ==

= Will CJDropshipping still recognise my orders? =

Yes. CJ matches order items by SKU, and every translation shares the SKU of the original product and of each variation. Orders placed in any language sync to CJ exactly like the English ones.

= Does it work with WPML? =

No, it is built for Polylang (plus woo-poly-integration). Polylang's free version is enough.

= What does the free plan include? =

10 products per site, each translated into every language configured in Polylang. An unlimited license is available at [asperor.com](https://asperor.com/ai-product-translator/).

= Are already-translated products overwritten? =

No. Products that already have a translation in a language are skipped for that language.

= What about the cart, checkout and other shop pages? =

Those are covered by the official WordPress/WooCommerce language packs and Polylang string translations — this plugin focuses on products and their taxonomies.

== Screenshots ==

1. Settings page: connect the site to the translation service and see the free/unlimited plan status.
2. Settings page: target languages, automatic translation toggle, initial delay and term translation option.
3. Bulk-translate existing products: pending products count and the "Translate all pending" button.
4. Activity log with translation history (date, product, language, status).

== Changelog ==

= 1.2 =
* Hardened the translation process: a fatal error thrown by another plugin hooked into WooCommerce/Polylang (for example a PHP 8 incompatibility in woo-poly-integration) no longer leaves a half-created translated product or stops the background job. The orphaned product is now removed automatically and the translation is retried.

= 1.1 =
* Removed the deprecated load_plugin_textdomain() call (translations now load automatically via WordPress.org).
* Shortened the plugin's short description to fit the 150-character limit.

= 1.0.0 =
* First public release: automatic translation of CJ products, linked Polylang translations with shared SKUs, term translation, bulk actions, activity log, free plan (10 products) and license activation.
