=== Flex Translate ===
Contributors: flexfields
Tags: multilingual, translation, localization, language-switcher, i18n
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.3.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add multilingual support with path-based URLs, string translations, content groups, and optional per-language fonts.

== Description ==

**Flex Translate** is a lightweight, developer-friendly plugin for multilingual WordPress sites.

* **Text translations** with `ft( 'code' )` and `ft_get( 'code' )`
* **Content translations** for posts and pages (same slug per language)
* **Path-based URLs** such as `/ru/about` and `/en/contact`
* **Language switcher** helper with optional flag images
* **Per-language fonts** (self-hosted uploads or optional Google Fonts by family name)
* **Taxonomy term** name/description translations
* Clean uninstall (tables, options, and meta removed)

= External services =

Optionally, when you enter a Google Font family name in **Manage Fonts**, the plugin builds a Google Fonts stylesheet URL and loads it on the front end for visitors of that language. This is optional; you can use self-hosted font files instead. Users never paste arbitrary CSS/JS.

* Service: [Google Fonts](https://fonts.google.com/)
* Terms: [Google Terms of Service](https://policies.google.com/terms)
* Privacy: [Google Privacy Policy](https://policies.google.com/privacy)

No Google Fonts requests are made unless you choose a Google Font family for a language.

= Privacy =

Flex Translate stores language settings, translation strings, and optional font settings in your WordPress database. It does not send site content to Flex Translate servers. If you enable Google Fonts, browsers may request font files from Google; see the links above.

== Installation ==

1. Upload the `flex-translate` folder to `/wp-content/plugins/`, or install the zip via **Plugins → Add New → Upload Plugin**.
2. Activate **Flex Translate**.
3. Go to **Flex Translate → Languages** and add your languages (set one as default).
4. Optionally configure fonts under **Manage Fonts** and string translations under **Text Translations**.
5. For posts/pages, use the **Translation** sidebar to assign a language or duplicate into another language.
6. Visit **Settings → Permalinks** and click **Save** once after activation (or after adding languages) so rewrite rules refresh.

== Frequently Asked Questions ==

= How do I show a translated string? =

Use these helpers in your theme templates:

    ft( 'main' );            // echoes the translation
    $val = ft_get( 'main' ); // returns the translation

= What URL format does the plugin use? =

Clean path-based URLs: /ru/about, /am/contact. The default language has no prefix (/about) unless you enable "Prefix for Default Language" in Settings.

= Can posts share the same slug in different languages? =

Yes. For example /test-page (default) and /ru/test-page can use the same slug when each has a different language assigned.

= How do I show a language switcher? =

    echo ft_language_switcher();


= Does the plugin require Google Fonts? =

No. Google Fonts are optional. Prefer uploading `.woff2` / `.woff` / `.ttf` / `.otf` files in Manage Fonts if you want fully self-hosted fonts.

== Screenshots ==

1. Languages admin – manage languages, default, and public visibility.
2. Text Translations – translation keys per language with search and pagination.
3. Manage Fonts – Google Font family name / weights or self-hosted uploads and CSS variables.
4. Post editor Translation box – language, siblings, and duplicate helper.

== Changelog ==

= 1.3.2 =
* Plugin Check: remove hidden files and deploy markdown from the plugin package.
* Sanitize request URI on default-language prefix redirects; list ORDER BY uses prepared identifiers.
* Google Fonts stylesheets enqueue with a version; fonts form unslashes POST data before save.

= 1.3.1 =
* Hyphenated language prefixes now save and load string translations correctly.
* Language and translation saves check database results and report unique-key errors.
* Default-language prefix redirects keep query strings; frontend permalinks stay in the browsing language when a sibling exists.
* Duplicate now remaps hierarchical parents; saving a language already used in the group is rejected.
* Admin saves use post-redirect-get; translation delete is POST; AJAX duplicate errors are localized.
* Language filtering applies to frontend secondary queries (widgets, Query Loop) with `flex_translate_skip_lang` to opt out.

= 1.3.0 =
* Admin UI aligned with Flex Redirects: shared header, pill navigation, cards, stats, and badges.

= 1.2.4 =
* Manage Fonts: removed freeform stylesheet URL field; Google Fonts URL is built from family name + weights only.
* Upload font files must come from the site Media Library (uploads directory).

= 1.2.3 =
* Additional nonce / global prefix hardening for WordPress.org review.

= 1.2.2 =
* Removed arbitrary custom CSS/JS fields from Manage Fonts (WordPress.org guideline).
* Fonts and debug switcher assets now use wp_enqueue_style / wp_add_inline_style.
* Prefixed admin script handles, localized objects, AJAX action, and option keys.
* Author URI set to https://flexible.am/; Plugin URI omitted (must differ from Author URI).

= 1.2.1 =
* WordPress.org preparation: LICENSE file, readme third-party/privacy disclosure, contributor slug alignment.
* Replaced emoji status markers with translatable Yes labels.
* Packaging and submission checklist for directory review.

= 1.2.0 =
* Query layer: language meta filtering limited to the main query; existing meta_query values are merged.
* Documented helpers `ft()`, `ft_get()`, `ft_get_translated_page_id()`, `ft_language_switcher()` added.
* Rewrite rules respect `category_base` / `tag_base`, CPT archives, and resolve singular posts/pages/CPTs via `ft_path`.
* Security: tighter AJAX duplicate caps, scoped font MIME filters, POST language delete, validated language prefixes.
* Removed unused `flex_translate_terms` table; taxonomy translations no longer mutate term slugs.
* Performance: fonts option not autoloaded; rewrite flush only when needed; text translations paginated; DDL moved to upgrades.
* i18n: `load_plugin_textdomain()`; multisite network activation support; flags in language switcher.

= 1.1.0 =
* Path-based URL routing (`/ru/about`) replaces the old `?lang=` approach.
* Full archive support: category, tag, author, search, date, feed, and pagination under language prefixes.
* New `ft_get()` function returns a translation string (vs `ft()` which echoes).
* Taxonomy term translation for categories and tags.
* "Prefix for Default Language" setting is now wired into the routing logic.
* Capability check added to content translation save handler.
* Floating debug switcher gated behind `WP_DEBUG`.
* Performance: `ft_get_translated_page_id()` results are now cached; taxonomy term filter skips admin and uses static caching.
* Deduplicated URL-rewriting helpers; consolidated language-detection functions.
* Security: `esc_url()` on Manage Fonts link; SQL injection fixes in admin queries.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.3.2 =
Plugin Check cleanup: sanitization, prepared ORDER BY, and package files.

= 1.3.1 =
Bug fixes for hyphenated prefixes, permalink language, secondary queries, and admin save integrity.

= 1.3.0 =
Admin screens now use the shared FLEX UI (header, cards, stats). No data migration required.

= 1.2.4 =
WordPress.org review: Google Fonts configured via family name form (no arbitrary stylesheet URLs).

= 1.2.3 =
WordPress.org review build: custom CSS/JS removed, assets enqueued, prefixes hardened, Plugin URI omitted.

= 1.2.2 =
Required for WordPress.org review: removes custom CSS/JS insertion; fonts use proper enqueue APIs.

= 1.2.1 =
Recommended before WordPress.org submission: documentation and packaging updates. Visit Permalinks → Save after upgrading if language URLs need a refresh.
