=== LiveLang – Smart Multilingual Visual Translator ===
Contributors: papanbiswasbd, arsyntax
Tags: translator, visual translator, translation, multilanguage, visual editor
Requires at least: 5.0
Requires PHP: 7.4
Tested up to: 7.1
Stable tag: 2.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Inline visual translator for WordPress with multi-language support, media translation, SEO URLs, and high-performance JSON caching.

== Description ==

LiveLang is the fastest, easiest visual translation plugin for WordPress. Translate or modify any frontend text, heading, button, or image directly on your live pages in real time.

**Translate Mode → Click any element → Edit → Save.**

No .po/.mo files. No complex string searches. No duplicate pages.

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

= ⚡ Visual Frontend Inline Translator =
* Click-to-edit interface directly on live pages
* Floating, draggable Control Dock with one-click toggle
* Preserves nested HTML (`<strong>`, `<em>`, `<a>`, `<span>`, `<br>`)
* Custom text alignment (Left, Center, Right) per translation
* Instant AJAX/REST API saving with smooth toast notifications

= 🖼️ Media & Image Translator =
* Display different images, banners, and logos per language
* Direct WordPress Media Library integration + custom URL support
* Translate image `alt` attributes for localized image SEO
* Automatic `srcset` / `sizes` handling for responsive images

= 🌐 Multi-Language System & SEO Optimized =
* Clean URL structure with language slugs (e.g. `/es/about/`, `/bn/contact/`)
* Default language clean URLs (no slug on primary language)
* Dynamic internal link prefixing across menus, footers, and links
* Automatic SEO tags: `<html lang>`, `hreflang`, `x-default`, and `og:locale`
* Translation of meta descriptions, Open Graph, and Twitter cards
* Optional browser language auto-detection
* Full RTL support (Arabic, Hebrew, Persian, Urdu)

= 🔘 Flexible Language Switchers =
* WordPress Menu integration via dedicated Menu Metabox
* Customizable floating language switcher with custom positions & colors
* Flexible shortcode `[livelang_language_switcher]` with layout options
* Country flags included for all languages

= 🎯 Page-Specific vs. Global Translation Modes =
* **Page-Specific:** Translate content unique to a single page
* **Global Mode:** Translate shared elements (header, footer) once site-wide
* Longest-first matching algorithm prevents substring collision

= 🚀 High-Performance JSON Caching =
* Versioned JSON caching reduces DB queries to near-zero
* High-speed client-side DOM translation using compiled regex + Map lookups
* Scoped MutationObserver with `requestAnimationFrame` batching
* Persistent object cache compatible (`wp_cache_flush_group`)

= 🛍️ Page Builder & WooCommerce Ready =
* Fully compatible with Elementor, Gutenberg, Divi, and all themes
* Translates WooCommerce shop products, cart, and AJAX mini-cart fragments
* Form input & `<textarea>` placeholder translation
* Batch dropdown `<select>` and `<option>` translator

= 🛠️ Centralized Admin Management =
* Translations Manager with search, language filters, and status toggles
* Bulk actions: Activate, Deactivate, and Delete
* Safe Maintenance Zone with scoped data clearing & CSV export
* Role-based access control (Admin, Editor, or custom roles)

== Key Features ==

* Frontend visual click-to-edit translation
* Multi-language management within a single page
* Media Translator for language-specific images and alt tags
* Form placeholder and dropdown option translation
* Page-specific & global translation scopes
* SEO-friendly URLs with automatic hreflang, lang, and og:locale tags
* Global internal link prefixing across all site menus and links
* RTL language support with automatic direction handling
* Built-in WordPress Menu metabox integration
* Customizable floating and shortcode language switchers
* High-performance JSON caching system
* WooCommerce and Elementor editor compatible
* Database-stored translations (100% update-proof)
* Translations list table with search, filters, bulk actions & CSV export
* Supports up to 3 active languages

== Shortcode & Usage ==

Embed the language switcher anywhere using shortcode:

`[livelang_language_switcher]`

**Available Attributes:**
* `style`: `"dropdown"` or `"inline"` (Default: dropdown)
* `appearance`: `"button"` or `"link"` (Default: button)
* `display`: `"both"`, `"flag"`, or `"text"` (Default: both)

**Examples:**
* `[livelang_language_switcher style="inline" display="both"]`
* `[livelang_language_switcher style="dropdown" appearance="button"]`
* PHP: `<?php echo do_shortcode('[livelang_language_switcher]'); ?>`

== Installation ==

1. Upload plugin files to `/wp-content/plugins/livelang` or install via WordPress Plugins screen.
2. Activate the plugin.
3. Navigate to **LiveLang Settings** to configure languages and switcher styles.
4. Add the language switcher via **Appearance → Menus**, floating switcher, or shortcode.
5. Visit your frontend, click **Translate**, and edit text or images in real time!

== Frequently Asked Questions ==

= How do I start translating? =
Enable Translate Mode from the frontend toolbar or floating dock, click any text or image, edit, and click Save.

= How many languages are supported? =
You can configure and manage up to 3 active languages simultaneously.

= Do I need separate duplicate pages for each language? =
No. LiveLang translates content on the same page structure dynamically.

= Is LiveLang SEO-friendly? =
Yes. It provides clean URLs (e.g. `/es/page`), automatic `hreflang`, `og:locale`, and translates meta tags.

= Does it work with WooCommerce and Elementor? =
Yes. It works seamlessly with Elementor, Gutenberg, Spectra / UAGB, Divi, WooCommerce products, cart, checkout, and AJAX mini-cart fragments.

= Will my translations be lost during updates? =
No. All translations are stored securely in your database and remain completely intact.

== Installation ==

1. Upload `livelang` folder to the `/wp-content/plugins/` directory, or install directly through WordPress Plugins screen
2. Activate the plugin through the 'Plugins' screen in WordPress
3. Navigate to **LiveLang** in the WordPress Admin dashboard to configure your languages
4. View your website frontend, click **Translate Mode** in the admin toolbar or floating dock, and start clicking elements to translate!

== Screenshots ==

1. LiveLang Frontend Visual Translator in action
2. Draggable Control Dock and inline editor popover
3. Media Translator for language-specific images
4. Language Switcher options (Dropdown, Inline, Floating)
5. SEO-friendly language URL structure
6. Admin Dashboard and Translations Management table
7. Elementor & WooCommerce compatibility

== Changelog ==

= 2.2.1 =

* Fixed original text extraction in frontend visual editor with multi-layer normalization to accurately retrieve default language text in ORIGINAL badge
* Fixed REST API save error and undefined alignment variable handling
* Hardened URL rewriting to strictly protect external subdomains and domains from slug prefixes
* Added database table column verification for alignment
* Added Spectra / Ultimate Addons for Gutenberg (UAGB) block selector compatibility

= 2.2.0 =

* Added Per-Language Custom Font Selection in Admin Language Manager table: configure default/theme fonts or pick from curated Google Fonts (Cairo, Tajawal, Almarai, Amiri, Hind Siliguri, Noto Sans Bengali, Inter, Roboto, Poppins)
* Added automatic Google Font loader (wp_enqueue_style) and inline :lang({code}) and body.livelang-lang-{code} CSS styling engine
* Added Link URL Target (href) Translation support in Visual Translator editor popover, REST API, and frontend renderer
* Added "API Integration" tab under Settings for Google Gemini AI translation configuration with Gemini Flash models and API connection test tool
* Added REST API endpoint (/livelang-api/v1/ai-translate) for secure backend translation requests with HTML formatting and placeholder preservation
* Added AI Auto-Translate icon button in frontend Visual Translator editor popover for instant content auto-translation
* Fixed double language prefix (/ar//ar/) URL rewriting bug on link elements and improved dynamic language switcher URL preservation
* Full WordPress Coding Standards (WPCS) and PHPCS i18n compliance updates across all plugin files

= 2.1.11 =

* Fixed RTL image thumbnail stripping bug where responsive srcset and sizes attributes were stripped on untranslated images on RTL pages
* Added Reset button to live translation popovers across text elements, media/images, and dropdown option lists to revert content back to original both live and on server
* Added REST API endpoint (/livelang-api/v1/delete) for deleting translation records and flushing cache directly from editor popovers
* Fixed popover scope selector (Page Specific vs Global) to detect and highlight saved is_global status when opening editor modals
* Fully compliant with WordPress Coding Standards (WPCS) and PHPCS database prepared statement guidelines

= 2.1.10 =

* Added "Disable RTL Feature" toggle under General Settings > Core Configuration to disable automatic RTL layout formatting (dir="rtl" and body.rtl class) for Right-to-Left languages
* Filtered WordPress is_rtl hook to return false when RTL layout is disabled, ensuring full theme and plugin compatibility
* Fixed settings save conflict across different settings tabs (General Settings, Switcher Style) so saving one tab preserves option values on other tabs
* Enhanced settings sanitizer with section tracking and selective option merging

= 2.1.9 =

* Added global internal link prefixing across nav menus, footers, and builder links
* Added textarea placeholder translation in Visual Editor and parser
* Fixed compound phrase collisions with longest-first matching precedence
* Upgraded Visual Editor with original string reconstruction and entity decoding
* Enhanced popup tooltip positioning and multi-frame rendering

= 2.1.8 =

* Added Switcher Style setting (Dropdown and Inline horizontal list) under Switcher Options
* Added Shortcode Style setting with Flag with Text, Only Flag, and Only Text options
* Added Shortcode Design options with Button Style (pill buttons with background) and Link Style (clean text/flag links)
* Added full shortcode attribute support: `[livelang_language_switcher style="dropdown|inline" appearance="button|link" display="both|flag|text"]`
* Fixed footer layout blank space and overflow when language switcher shortcode is placed in footers, with automatic dropup orientation
* Enhanced admin live preview to dynamically reflect all switcher styles, layouts, and colors in real time

= 2.1.7 =

* Added customer portal integration: direct "Manage License" button in admin interface directing users to manage subscriptions, renewals, and billing securely
* Enforced universal license key privacy masking (sk_********************) across all dashboard states, protecting secret key strings from screenshots and screen recordings
* Added real-time date expiration validation (is_date_expired): automatically disables Pro features and reverts to 3-language limit immediately upon license expiration
* Added real-time license status sync (Sync / Refresh Status button) to pull instant subscription and expiration updates
* Added interactive hover tooltips and clear visual badges for disabled languages when running on Free tier
* Full WordPress 7.0 compatibility, WordPress i18n standards, and WordPress Coding Standards (WPCS) / Plugin Check compliance updates across all codebase files

= 2.1.6 =

* Completely removed external licensing dependencies, unlocking native support for unlimited language management directly from administrative dashboard
* Resolved nav menu double-arrow conflicts across themes (such as Astra) by automatically stripping duplicate arrow icons and isolating sub-menu items
* Enhanced RTL support with LTR/RTL-aware margin rules and flex gap alignment, guaranteeing a clean, consistent gap between flags, labels, and dropdown arrows in both right-to-left and left-to-right layouts
* Fixed WordPress Customizer (Appearance > Customize) nav menu fatal error by fully populating standard menu attributes and enabling real-time language dropdown rendering in live preview
* Codebase optimization and cleanup of legacy third-party tracking scripts

= 2.1.5 =

* Added Dropdown select and option Multi-Translator: hovering or clicking any select dropdown in visual editor opens dedicated Dropdown Translator popover to edit all options in a single batch
* Fixed Media Translation reload persistence: resolved issue where image URLs containing digits/upload dates were mistakenly corrupted by number-normalization patterns
* Added automatic URL variation expansion for media entries: generates protocol, root-relative, relative, and unscaled base image variations
* Enhanced srcset and sizes attribute stripping: automatically removes responsive srcset and sizes attributes from translated img and source tags on both server and client side
* Full WordPress 7.0 compatibility and WordPress Coding Standards (WPCS) compliance updates across all plugin files

= 2.1.4 =

* Added fixed floating "Translation Active" indicator at bottom right of screen for better visibility when translation mode is enabled
* Added polished UI for floating indicator, featuring pulsating dot, sleek dark gradient background, and rotate-on-hover close icon
* Enhanced compatibility by isolating floating indicator UI from active theme styles
* Added support for translating entire text blocks containing mixed inline HTML tags (strong, em, a, span)
* Added support for translating multi-line text blocks containing br tags
* Added drag-and-move support to floating Translation Active indicator

= 2.1.3 =

* Fixed Array to string conversion PHP warning on frontend when translations were saved
* Fixed REST API sanitize callbacks for translation save endpoint
* Added custom alignment for translations (left, right, or center)

= 2.1.2 =

* Fixed translated text duplication on frontend
* Fixed client-side MutationObserver re-translation handling
* Added per-element de-duplication for attribute translations (placeholder, title, alt, aria-label, data-title, value)

= 2.1.1 =

* Performance: rewrote dynamic client-side translation engine using single compiled regex and Map lookup
* Performance: MutationObserver scopes translation passes to actually changed elements
* Performance: translation passes batch via requestAnimationFrame
* WooCommerce: legacy AJAX cart/checkout fragments translated server-side
* Fixed translation precedence: page-specific translations reliably override global entries
* Fixed Flush Cache and Clear All Translations separation with safety confirmation modal
* Added CSV Export backup option

= 2.1.0 =

* SEO: Added automatic hreflang alternate tags (+ x-default) for every configured language
* SEO: Added og:locale meta tag matched to visitor's active language
* SEO: Translated meta description, Open Graph, and Twitter Card content attributes
* Admin UI: Added stats overview, search, per-language filter, and status filter
* Admin UI: Added bulk actions (activate, deactivate, delete) with select-all support
* Frontend UX: Replaced alert popups with smooth non-blocking toast notifications

= 2.0.4 =

* Fixed Elementor editor compatibility issues
* Added Media Translator for language-based images
* Improved multilingual image handling
* Enhanced compatibility with page builders
* Improved translation performance and caching
* Fixed minor bugs and improvements

= 2.0.3 =

* Made compatible with WooCommerce
* Added synchronization with WP Core Translations for mo file loading and automatic translation
* Added synchronization with WP Theme and Plugins translation files

= 2.0.2 =

* Modernized Administrative Dashboard with premium full-width fluid layout
* Redesigned Language Manager with high-fidelity live preview and upward-opening dropdowns
* Hardened security across administrative outputs using wp_kses and strict escaping
* Fixed critical early-initialization fatal error affecting plugins like WPForms
* Optimized admin menu icon size and alignment for global consistency
* Standardized upgrade paths and removed legacy pricing sections
* Performed comprehensive code audit and removed unused build artifacts

= 2.0.1 =

* Added fully customizable Floating Language Switcher with real-time admin preview
* Added ability to enable/disable floating switcher from settings
* Implemented high-performance versioned caching for translations
* Hardened REST API security with strict language validation
* Refined frontend switcher logic with accessibility and click-outside detection

= 2.0.0 =

* Major UI/UX overhaul of the WordPress Admin Toolbar
* Added custom premium "Radio-style" switcher for enabling/disabling the editor
* Fixed language preservation issue when toggling the editor
* Improved toolbar responsiveness across desktop and mobile devices
* Refined dropdown styles for language switching
* Enhanced performance of the toolbar UI

= 1.0.3 =

* Removed language code from URL for default language
* Fixed language switcher URL generation for default language
* Improved compatibility with various themes and plugins
* Fixed minor bugs and improved overall performance

= 1.0.2 =

* Added full compatibility with Pro version (supports unlimited languages)
* Improved multi-language system stability and consistency
* Fixed number filtering issue in translations
* Added dynamic lang attribute (e.g., lang="en-US") to HTML tag for better SEO & accessibility
* Fixed inconsistencies between global and page-based translations
* Resolved REST API URL issues for subdirectory WordPress installations
* Improved translation handling logic
* Fixed multiple minor bugs and improved overall performance

= 1.0.1 =

* Added full multi-language support
* Added SEO-friendly language URL structure (domain.com/lang/slug)
* Added built-in language switcher
* Added language switcher shortcode
* Added shortcode support for menus and PHP theme files
* Added country flags for each language
* Added high-performance JSON translation cache system
* Improved frontend UX/UI performance
* Free version limited to 3 languages
* Fixed bugs from previous version

= 1.0.0 =

* Initial release
* Added visual inline translation editor
* Added page-based and global translation modes
* WooCommerce compatibility
* Database-based translation storage