=== WorkMore Site Translator ===
Contributors: connextsystem
Tags: translation, multilingual, language switcher, bilingual, hreflang
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add a second language to your site: each translation is its own post or page under its own URL, with per-language menus, a switcher and hreflang tags.

== Description ==

WorkMore Site Translator gives a WordPress site a second language the way WordPress works best: every translation is a real post or page. Your existing content stays exactly as it is and is served at the root of your site; translations live under their own prefix (for example `/th/`) and are written in whatever editor you already use — the block editor, Elementor, Flatsome's UX Builder or any other — because a translation is simply another post.

**Translate by copying**

* Every post and page list shows a Languages column. One click creates a draft copy in the other language — content, excerpt, featured image, template, parent, builder data and custom fields included — and opens it for translation.
* Categories and tags are translated the same way, and a copied post is filed under the translated categories automatically (created on the fly when missing).
* Translations are linked, so the switcher, the hreflang tags and the admin bar always know where the other language lives.

**Clean URLs, correct SEO**

* Sub-directory URLs (`example.com/` and `example.com/th/`) that search engines index separately, one URL per post; a post opened under the wrong prefix is redirected to its own.
* `hreflang` alternates and `x-default` on every translated page, self-referencing canonical URLs, per-language sitemaps advertised in robots.txt — with WordPress' built-in sitemap, Yoast SEO and Rank Math.
* Visitors on `/th/` only see Thai content: archives, search, feeds, category lists, page lists, previous/next links and sticky posts are all scoped to the language. The front page and the posts page map to their translations.

**Menus, switcher, site title**

* Every menu location of your theme gets a twin per language under Appearance → Menus → Manage Locations. Assign a menu built in that language and the theme shows it on translated pages — no theme changes.
* A language switcher in four styles — inline links, list, pills or dropdown, with an optional accent color and a live preview in the settings — as a menu item, a widget, the `[wmst_switcher]` shortcode or the `wmst_language_switcher()` template tag. It links to the translation of the current content and loads no JavaScript.
* The site title and tagline can be set per language.

**Language packs do the interface**

On translated pages WordPress loads the language's own packs, so core, your theme and your plugins show their interface text (buttons, dates, form labels) in that language automatically. A one-click installer for the pack lives in the settings.

**Light**

* Language is a normal, indexed term relationship; lists are filtered by one clause. No output buffering, no HTML parsing, no cookies.
* No JavaScript and no stylesheet files on the frontend. Pages that show a language switcher get its CSS (1–3 KB) inline, through WordPress' own style API.

**Source code**

The plugin's JavaScript ships minified for performance; the human-readable source is included in the plugin's `src/` directory together with the build configuration (`vite.config.js`).

**Pro add-on**

Everything above is free and complete for a site with two languages, its posts and pages. A separate Pro plugin, sold on [workmore.connextsystem.com](https://workmore.connextsystem.com/), adds unlimited languages, custom post types and taxonomies (portfolios, Elementor templates, Flatsome UX Blocks…) and a complete WooCommerce integration: products, variations, categories and attributes, synced price and stock, shop, cart, checkout and account pages per language, cart and order language, customer emails in the customer's language. Inside this plugin the add-on is only mentioned on the "Upgrade to Pro" settings tab; nothing here is locked or limited.

== Frequently Asked Questions ==

= How do I translate a page? =

Open Pages, find the page and click the "+" in its Languages column. A draft copy opens in your editor; translate it and publish. The two pages are linked from then on.

= Does it work with Elementor, Flatsome and other page builders? =

Yes. A translation is a copy of the page including the builder's data, so it opens in Elementor, Flatsome's UX Builder or any other builder exactly like the original — you translate the texts in place.

= What about my existing content? =

Everything that exists when you activate the plugin is in your default language and keeps its URL. Nothing is copied or changed until you create a translation.

= Which language should be the default? =

The language most of your content is written in. Visitors get that language at your plain URLs and the second language under its prefix (`/th/`, `/en/`, …). The default language also decides which core, theme and plugin translations the visitor side loads — independently of Settings → General → Site Language, which keeps governing the dashboard. If you already have content in both languages, pick the bigger one as the default and mark the rest in the Language box or with Tools → Assign.

= How do I add the language switcher? =

Three ways, all set up under Settings → Site Translator, where you pick the style (inline links, list, pills or a dropdown), the label (native name, English name or code) and an optional accent color, and see a live preview: as a menu item (Appearance → Menus → "Language switcher"), as a widget, or with the `[wmst_switcher]` shortcode / `wmst_language_switcher()` template tag anywhere in your content, builder or theme. No JavaScript is loaded; the switcher takes the color of the text around it, so it fits light and dark headers alike, and `color="…"` / `bg="…"` on the shortcode (or a few CSS variables, listed in the settings) recolor it.

= Can I translate menus? =

Yes. Build a menu in the second language and assign it to the language twin of a location under Appearance → Menus → Manage Locations. A language switcher can be added to any menu as well.

= Does it work with WooCommerce? =

The WooCommerce integration — translated products, variations, categories and attributes, synced price and stock, shop/cart/checkout/account pages per language, cart and order language, customer emails — is part of the separately sold Pro add-on. This plugin translates posts and pages.

= Does the plugin slow my site down? =

No. A language is an ordinary term on each post; lists are filtered by one indexed clause, translations are read from the object cache, and the only frontend output besides the hreflang tags is the switcher's small inline CSS on pages that show a switcher.

= Does the plugin connect to any external service? =

No. The plugin makes no network requests of its own. The optional "Install language pack" button on the settings screen uses WordPress' own language-pack installer, which downloads from WordPress.org exactly as Settings → General does. The only outbound link is the "Upgrade to Pro" button, which opens our website when you click it.

= What happens if I uninstall the plugin? =

Deactivating never deletes anything. Uninstalling removes language assignments, translation links and settings only if you opted in to "Delete language data and settings when the plugin is uninstalled". Translated posts and pages are ordinary content and are never deleted.

== Screenshots ==

1. The Pages list with the Languages column: current language, edit and create links.
2. The Language box in the editor: language of the content and its translations.
3. A translated page under its own URL, with the language switcher in the menu.
4. Appearance → Menus → Manage Locations with the per-language twins.
5. Settings: languages, language-pack status, site title per language, switcher options.
6. hreflang and canonical tags on a translated page.

== Changelog ==

= 1.0.0 =
* Initial release: a second language under a sub-directory prefix; translations as linked copies of posts, pages, categories and tags; language-scoped lists, front page and posts page mapping, one-URL-per-post redirects; per-language menu locations, language switcher (menu item, widget, shortcode, template tag), site title/tagline per language; hreflang, canonical and per-language sitemaps; language-pack installer; opt-in clean uninstall.

== Upgrade Notice ==

= 1.0.0 =
First release.
