=== PolyTranslate AI for Polylang ===
Contributors: almhdy, freemius
Tags: polylang, ai translation, automatic translation, translation, translate
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 5.0.1
License: GPLv3
License URI: https://opensource.org/licenses/GPL-3.0

AI automatic translation for Polylang. Translate posts, pages, WooCommerce, ACF, SEO meta & custom fields using OpenAI, DeepL, Google or OpenRouter.

== Description ==

[youtube https://www.youtube.com/watch?v=C7j_cFFcTTo]

AI automatic translation for Polylang. Translate posts, pages, WooCommerce, ACF, SEO meta & custom fields using OpenAI, DeepL, Google or OpenRouter.

**With one click, you can automatically translate:**

- Posts and Pages
- Custom Post Types
- WooCommerce Products, Categories, Tags, Attributes & Brands
- Categories and Tags
- Custom Taxonomies
- Custom Fields (ACF, Meta Box, etc.)
- SEO meta data (Yoast, Rank Math, SEOPress, AIOSEO)
- Elementor pages
- Gutenberg block content
- Polylang Strings

This plugin enhances Polylang by adding professional AI translation capabilities directly inside the WordPress admin.

**This is NOT a standalone translation plugin** - it works exclusively with Polylang to add automatic translation capabilities.

== 🚀 How It Works ==

1. Install and configure Polylang.
2. Install PolyTranslate AI.
3. Add your preferred AI provider API key.
4. Click the Translate button inside the editor.

Your translated content is generated and saved as a normal Polylang translation.

== Key Features ==

- **Posts & Pages Translation** - Translate any content instantly
- **Custom Post Types Translation** - Works with any custom post type
- **WooCommerce Products Translation** - Product titles, descriptions, and short descriptions
- **WooCommerce Product Variations & Attributes** Sync Product Variations & Attributes
- **Advanced Custom Fields (ACF) Support** - All field types including repeaters
- **Meta Box Fields** - Complete Meta Box plugin support
- **Any Custom Fields** - Universal custom field translation
- **Categories & Tags** - Translate taxonomies
- **Custom Taxonomies** - Translate any registered custom taxonomy
- **Gutenberg Block Content** - Full block editor support
- **Elementor Pages** - Full page builder support
- **Bulk Translation** - Translate hundreds of posts at once
- **Bulk Polylang Strings Translation** - Translate all registered strings in bulk
- **Complete SEO Meta Translation** - (Yoast, Rank Math, SEOPress, All in One SEO Pack)
- **Multiple AI Services** - OpenAI, DeepL, Google Translate, OpenRouter
- **Smart Language Detection** - Automatically detects source language
- **Translate Link Targets** - Automatically update post links to point to translated versions.
- **Preserve Original Publish Date** - Keep the original post date on translations
- **Preserve Original Author** - Keep the original post author on translations
- **API Connection Test** - Test your API key directly from the settings page

== FREE vs Premium ==

The **Free version** includes:

✅ Posts & Pages Translation
✅ Custom Post Types Translation
✅ WooCommerce Products Translation
✅ WooCommerce Categories, Tags, Attributes & Brands
✅ Categories, Tags & Custom Taxonomies Translation
✅ Gutenberg Block Content Translation
✅ Translate Link Targets
✅ Preserve Original Publish Date
✅ Preserve Original Author
✅ Register Polylang Strings
✅ Unlimited Translations
✅ Multiple AI Services (OpenAI, DeepL, Google, OpenRouter)
✅ Language Auto-Detection

The **Premium version** includes:

✨ Everything in Free, plus:
✨ Bulk Translation
✨ Bulk Polylang Strings Auto Translation
✨ Custom Fields Translation (ACF, Meta Box, etc.)
✨ SEO Meta Translation
✨ Elementor Pages Support
✨ Priority Support

[How to Configure Api Settings](https://www.youtube.com/watch?v=5JHaU3IGB3o)

[youtube https://www.youtube.com/watch?v=5JHaU3IGB3o]

[Translate ACF & Custom Meta Fields in WordPress](https://www.youtube.com/watch?v=9Hx3v5b_Tbc)

[youtube https://www.youtube.com/watch?v=9Hx3v5b_Tbc]

== External Services ==

PolyTranslate AI connects to third-party translation APIs when you trigger translations. **You control your data and costs** by providing your own API keys:

1. OpenAI  
   - Links: [Terms](https://openai.com/policies/terms-of-use) | [Privacy](https://openai.com/policies/privacy-policy)

2. DeepL Pro  
   - Links: [Terms](https://www.deepl.com/pro-license/) | [Privacy](https://www.deepl.com/privacy/)

3. Google Translate API  
   - Links: [Terms](https://policies.google.com/terms) | [Privacy](https://policies.google.com/privacy)

4. OpenRouter.ai  
   - Links: [Terms](https://openrouter.ai/terms) | [Privacy](https://openrouter.ai/privacy)

**This is a third-party addon for Polylang - not affiliated with or endorsed by Polylang.**

== Installation ==

**⚠️ PREREQUISITES: You MUST have Polylang installed first!**

**Quick Start (5 minutes):**

1. **Install & Configure Polylang**
   - Install [Polylang](https://wordpress.org/plugins/polylang/) if you haven't already
   - Go to Languages → Settings in your WordPress admin
   - Add your site's languages
   - Configure URL structure and language switcher

2. **Install PolyTranslate AI Addon**
   - Go to Plugins → Add New
   - Search for "PolyTranslate AI"
   - Click Install & Activate
   - (Or upload manually to `/wp-content/plugins/polytranslate-ai/`)

3. **Configure Translation API**
   - Go to **PolyTranslate AI → Settings**  
   - Choose your preferred translation service
   - Add your API key (OpenAI, DeepL, Google, or OpenRouter)
   - Save settings

4. **Start Translating**
   - Edit any post/page/product in Polylang
   - Click the **Translate** button added by this addon
   - Select target languages
   - Watch automatic translation happen!

[How to Configure Api Settings](https://www.youtube.com/watch?v=5JHaU3IGB3o)

[youtube https://www.youtube.com/watch?v=5JHaU3IGB3o]

[Translate ACF & Custom Meta Fields in WordPress](https://www.youtube.com/watch?v=9Hx3v5b_Tbc)

[youtube https://www.youtube.com/watch?v=9Hx3v5b_Tbc] 

== Frequently Asked Questions ==

= Does this work without Polylang? =
**No.** This is an addon that adds automatic translation to Polylang. You must install and configure [Polylang](https://wordpress.org/plugins/polylang/) first. Without Polylang, this plugin will not function at all.

= Why do I need both Polylang and this addon? =
**Polylang** handles the multilingual structure (language management, URL structure, language switcher, manual translations).
**PolyTranslate AI** handles automatic content translation (AI-powered translation using OpenAI, DeepL, or Google).

= Is this an official Polylang product? =
No. This is an independent third-party addon created to work with Polylang. We are not affiliated with or endorsed by the Polylang team. We simply integrate with their excellent language management system.

= Will this work with Polylang Pro? =
Yes! This addon works with both the free Polylang and Polylang Pro. It extends either version with automatic AI translation capabilities.

= Is this plugin completely free? =
The core plugin is free with powerful translation features. Premium features (ACF fields, bulk translation, advanced SEO support) require a license, but you'll still save thousands compared to traditional translation methods.

= Can I translate Advanced Custom Fields? =
Yes! The premium version fully supports ACF fields including text, textarea, WYSIWYG, repeater fields, and more. Also supports Meta Box and other custom field plugins.

= Is there a restriction on how many languages I can translate? =
No. You can translate to as many languages as you want. Polylang handles the language management, and this addon translates content between those languages.

= What happens if I uninstall the plugin? Do all translations get lost or are they still there? =
All translations will still be there. This plugin only adds automatic translation capabilities. Once content is translated and saved, it becomes part of your WordPress database just like any other content.

= Does this plugin support the classic editor? =
Yes! This plugin works with both the Classic Editor and Gutenberg block editor.

= Is my content secure? =
Absolutely. Your content goes directly from your site to your chosen AI service using your API keys. We never see, store, or have access to your content or API keys.

= Can I translate WooCommerce stores? =
Yes! Both free and premium versions support WooCommerce products. The free version also includes categories, tags, attributes, and brands. Premium adds advanced WooCommerce SEO meta translation.

= Does it work with page builders? =
Premium version supports Elementor fully. Gutenberg works out of the box. Other page builders work for basic content - contact us for specific compatibility questions.

== Screenshots ==

1. OpenAI API Settings.
2. OpenRouter API Settings.
3. Single Translation.
4. Bulk Translation.

== Changelog ==


= 5.0.1 =
🔧 **FIXED**: Referer header added to AI connection requests on google
⚠️ **NOTICE**: Model selection tips added to API tab
⚡ **IMPROVED**: Support most of Essential Addon fields.

= 5.0.0 =
🚀 **NEW**: Move Categories, Tags & Custom Taxonomies translation to Free version
🚀 **NEW**: Move WooCommerce categories, tags, attributes & brands translation to Free version
🚀 **NEW**: Move Preserve publish date & author options to Free version
🚀 **NEW**: Move Polylang register strings to Free version
🚀 **NEW**: API connection test handler & endpoint in settings page
⚡ **IMPROVED**: Bulk translation now continues on partial failures
🔒 **SECURITY**: Capability check updated from edit_posts to publish_posts
🔧 **FIXED**: Multiple translate links on same page
🔧 **FIXED**: Broken link in row action
🔧 **FIXED**: Source title sent as array instead of string
🔧 **FIXED**: Fatal error when WooCommerce is inactive
🔧 **FIXED**: Incomplete AJAX response in translation handler
🔧 **FIXED**: Table header markup in advanced settings tab

= 4.1.0 =
🔧 **FIXED**: Nested array translation in block attributes
🔧 **FIXED**: JSON code handling in block attributes
🔧 **FIXED**: Duplicate space in Google API calls
🔧 **FIXED**: Redundant translations between block attributes and HTML blocks
⚡ **IMPROVED**: Enhanced styling and performance

= 4.0.0 =
* 🚀 **NEW**: Automatic translation for polylang strings
* 🚀 **NEW**: Option to register strings to polylang
* ⚡ **IMPROVED**: Link target translation functionality

= 3.0.2 =
* 🔧 **FIXED**: Translation of content containing special characters
* ⚡ **IMPROVED**: Block attributes translation for better Gutenberg compatibility

= 3.0.1 =
* 🔧 **FIXED**: Could not extract translation array from response

= 3.0.0 =
* 🚀 **NEW**: Option to Preserve original publish author
* 🚀 **NEW**: Smart batch translation for long content to prevent timeouts
* 🚀 **NEW**: Reduced API cost by sending visible text only
* 🚀 **NEW**: Rank Math focus keyword translation
* ⚡ **IMPROVED**: Faster translation processing for large content
* 🔧 **FIXED**: Gutenberg compatibility issues


= 2.2.0 =
* 🚀 **NEW**: Added option to preserve original publish date

= 2.1.3 =
* Fixed Bugs
* Work with deepL free and Pro
* Fix DeepL issue with Gutenberg editor

= 2.1.2 =
* Fixed: Compatibility with latest Polylang version
* Fixed Bugs

= 2.1.1 =
* Fixed Bugs
* Enchanced security

= 2.1.0 =
* 🚀 **NEW**: Add seo meta title translation support
* Fixed Bugs

= 2.0.5 =
* Fix Skip Polylang language switcher links

= 2.0.4 =
* Fixed Bugs

= 2.0.3 =
* Fixed Bugs

= 2.0.2 =
* 🚀 **NEW**: Add Translate Link Targets

= 2.0.1 =
* Fixed Bugs

= 2.0.0 =
* 🚀 **NEW**: Advanced Custom Fields (ACF) complete integration - translate all ACF field types
* 🚀 **NEW**: Meta Box plugin support - translate Meta Box custom fields  
* 🚀 **NEW**: Universal custom fields translation - works with any custom field plugin
* 🚀 **NEW**: Enhanced bulk translation with progress indicators
* ⚡ **IMPROVED**: Faster translation processing for large content
* ⚡ **IMPROVED**: Better error handling and user feedback
* 🔧 **FIXED**: Minor UI improvements and bug fixes

= 1.1.0 =
* NEW: Added compatibility for translating Elementor pages
* IMPROVED: Enhanced WooCommerce product translation  
* FIXED: Various stability improvements

= 1.0.0 =
* 🎉 Initial release with OpenAI, DeepL, Google Translate, and OpenRouter support
* ✅ Free translation for posts, pages, and WooCommerce products
* ✅ Premium features for taxonomies and SEO plugin integration