=== WakaLang ===
Contributors: noricku, wakalab
Tags: multilingual, translation, hreflang, language-switcher, i18n
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.2.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Keep visitors in their language. Lightweight URL-prefix language routing, hreflang, and a language switcher for WordPress.

== Description ==

WakaLang is a lightweight multilingual plugin for WordPress sites that publish manually translated content. It keeps the current language stable through clean URL prefixes such as `/en/about/` and `/ja/about/`, then helps you connect translated posts, terms, menus, navigation blocks, SEO metadata, and `hreflang` output.

The free plugin is complete for manual multilingual publishing and makes no external network calls.

**Free features**

* Register the languages your site offers (code, locale, names, URL prefix, default).
* URL-prefix routing: every page is reachable under each language prefix (`/en/…`, `/ja/…`), with the prefix as the single source of truth for the active language.
* A language switcher with automatic header/footer placement, an editor block, the `[wakalang_switcher]` shortcode, and the `wakalang_language_switcher()` template function — with optional flags rendered as Unicode emoji (no external requests).
* `hreflang` alternate links (and an optional `x-default`) for translated content.
* Internal links, menu links, the site/home link, and block-theme (FSE) navigation all keep the current language's URL prefix.
* Link posts, pages, and taxonomy terms into translation groups from a post or term editor, and create draft translations.
* Archive, search, RSS/Atom feeds, and the core `wp-sitemap.xml` are scoped to the current language.
* Translate taxonomy terms (category, tag, custom taxonomy) with per-language name and slug.
* Manage a per-translation SEO title and meta description, handed to WordPress core and to Yoast / Rank Math (their own meta is never touched).
* Translate the site title and tagline per language.
* Review translation coverage, maintenance checks, FAQ, troubleshooting, support routes, and system information inside wp-admin.

**Privacy**

WakaLang does not call any external service, does not track visitors, and stores no personal data. It runs entirely on your own site.

**Third Party Services**

WakaLang Free does not connect to any third-party service, CDN, telemetry endpoint, license server, or translation API. It serves its assets from your WordPress site and performs language routing locally.

**Optional add-on**

A separate paid add-on is planned for AI-assisted, Markdown-safe translation using an administrator-provided API key, glossary, translation memory, and differential translation. The free plugin contains none of that add-on code and works fully without it.

**Getting started**

After activation, open **WakaLang → Languages**, add your languages, set the default language, open **WakaLang → Settings** to choose switcher placement, then use the WakaLang editor panel to assign languages and link translated versions. The full user manual is inside **WakaLang → Guide**.

== Installation ==

1. In WordPress, go to **Plugins → Add New**, search for **WakaLang**, install it, and activate it.
2. To install from a ZIP, go to **Plugins → Add New → Upload Plugin**, upload the WakaLang ZIP, install it, and activate it.
3. Go to **WakaLang → Languages** to register your languages and set a default.
4. Go to **WakaLang → Settings** and choose a header or footer language switcher position, or add the block/shortcode where you want it manually.
5. Open **WakaLang → Guide** for setup steps, usage notes, FAQ, troubleshooting, support routes, and system information.

== Frequently Asked Questions ==

= After installing, what should I do first? =

Add your languages under **WakaLang → Languages**, set the default language, choose switcher placement under **WakaLang → Settings**, then assign languages and translation groups in the post or page editor.

= What should I do if settings are not reflected? =

Flush rewrite rules from **WakaLang → Tools**, clear page/object/CDN caches, and confirm you are viewing a URL with the expected language prefix.

= Can I use WakaLang with my theme or cache plugin? =

Yes in normal setups. Clear caches after changing URL, menu, or switcher settings. If a problem appears, temporarily disable optimization plugins or switch themes to isolate the conflict.

= What is the difference between Free and Pro? =

WakaLang Free is complete for manual multilingual publishing. WakaLang Pro is a separate add-on for licensed AI-assisted translation workflows and is not bundled in the free WordPress.org plugin.

= Where can I get support? =

Use the WordPress.org support forum for WakaLang Free. Do not post license keys, API keys, account details, payment information, or refund requests in public forum threads; use the Pro support route shown inside the plugin when applicable.

= Does WakaLang Free send my content anywhere? =

No. WakaLang Free makes no external network calls, does not use a CDN, does not include telemetry, and does not perform license checks.

== Screenshots ==

1. Initial language setup screen after activating the plugin.
2. Main settings screen for URL behavior, switcher placement, and navigation options.
3. Post editor translation panel for assigning a language and linking translated versions.
4. Front-end language switcher output on a prefixed page.
5. Language Switcher block options in the block editor, rendered by the same front-end switcher.

== Source Code ==

WakaLang ships as readable PHP; the only compiled asset is the block editor script.

* `assets/blocks/language-switcher/build/index.js` is the compiled Language Switcher block editor script. Its human-readable source ships in this plugin under `assets/blocks/language-switcher/src/` (`index.js`, `edit.js`, `block.json`).

To rebuild it, install Node.js, run `npm install`, then `npm run build:blocks` (which runs `@wordpress/scripts`). No other plugin code is minified or generated by a build tool.

== Upgrade Notice ==

= 0.2.5 =
Maintenance update for the plugin details link.

== Changelog ==

= 0.2.6 =
* Block themes: assign a different navigation per language for each navigation your site uses. Header and footer (or any separate Navigation blocks) can now each be mapped independently — on a non-default-language page the navigation you chose for that language is shown in its place. Configure it under WakaLang → Settings → Navigation menus, where each navigation your site references appears as its own row; the default language keeps the original.
* Optionally scope secondary post listings to the current language. When enabled under WakaLang → Settings, Recent Posts widgets, Latest Posts blocks and other secondary queries on a language page (e.g. /en/) show only that language's posts, matching the main archive. Off by default; a theme can keep a specific query showing every language with the `wakalang_filter_secondary_queries` filter.

= 0.2.5 =
* Avoid duplicating the plugin "View details" link.

= 0.2.4 =
* Assign a different navigation menu per language to each theme menu location: on a non-default-language page (e.g. /en/) the menu you assigned for that language is shown in place of the theme's default, so labels, items and order can differ per language. Configure it under WakaLang → Settings → Navigation menus; the default language keeps the theme's own assignment. Only menus shown through a theme menu location are affected, and the feature can be turned off.

= 0.2.1 =
* Agent-assisted migration from Polylang and WPML: import existing language assignments and translation groups into WakaLang locally (no external requests), via the WakaLang → Tools screen, the `wp wakalang migrate polylang|wpml` command, or the `import-from-polylang` / `import-from-wpml` abilities. Post content and slugs are never moved; imports default to a dry-run preview and are bounded per run.
* Expose WakaLang's agent abilities on the core WordPress Abilities REST API (WP 6.9+) via `meta.show_in_rest`. Read-safe abilities (list languages, get settings, diagnose, …) are reachable over REST; writes stay behind authentication and capability checks.
* Languages screen: reject adding a language whose URL prefix is already used by another language (previously only a duplicate code was caught, so two languages could share a URL prefix). Code and URL-prefix conflicts now show an error notice, matching the REST/CLI behavior.

= 0.2.0 =
* Exclude pro scope commits from the free changelog.
* Replace wporg screenshot placeholders.

= 0.1.1 =
* Settings and "View details" action links on the Plugins list row.

= 0.1.0 =
* Language registry (option-backed) with an admin **Languages** screen: each language carries a code, locale, name, native name, URL prefix, default flag and enabled flag.
* URL-prefix rewrite routing (`/ja/…`, `/en/…`) — the prefix is the source of truth for the current language; rewrite rules flush on activation/deactivation.
* Current-language context service and public template functions (`wakalang_get_current_language()`, `wakalang_get_supported_languages()`, …), with optional root-request browser-language detection and a preferred-language cookie (both off-by-default-friendly and configurable).
* Settings screen for URL mode, fallback behaviour, hreflang, x-default, cookie/browser-detection toggles and uninstall data handling.
* Translation linking: a custom `wp_wakalang_translations` table and a post-editor meta box to set a post's language, link it into a translation group, see the other-language versions, and create a draft translation. Rows are removed when a post is permanently deleted; group changes fire the `wakalang_translation_group_updated` action.
* Translation repository served through the WordPress object cache (negative lookups cached, writes purge touched entries); `merge_groups()` folds one translation group into another, refused on a same-language collision.
* Language switcher via the `[wakalang_switcher]` shortcode, the `wakalang_language_switcher()` / `wakalang_get_language_switcher()` template functions, and an editor block. The current language renders as a non-link with `aria-current`; output passes through `wp_kses()`.
* Language switcher display options: a `flags` mode (`name` / `flag` / `flag_and_name`) rendering each language's flag as a Unicode emoji from its locale (no bundled images, no external requests), a global show/hide toggle, and automatic header (`wp_body_open`) or footer (`wp_footer`) placement.
* hreflang `<link rel="alternate" hreflang="…">` tags in `wp_head` for a page's language variants, plus an optional `x-default`. Filterable via `wakalang_hreflang_entries`.
* Language-preserving links: `post_link` / `page_link` / `post_type_link` / `term_link`, nav-menu item URLs, `home_url()` output, and block-theme/FSE navigation links keep the current language's URL prefix. External links, anchors, `mailto:`/`tel:`, `/wp-admin/`, REST and feeds are left untouched.
* Query language scoping: archive, search and feed (RSS/Atom) queries, plus the core `wp-sitemap.xml` (split per language), are filtered to the current language via shared `posts_clauses` / `terms_clauses` SQL with cache invalidation.
* Taxonomy translation: categories, tags and public custom taxonomy terms carry per-language name/slug and link into translation groups, with a term-editor field and a Translations column in term lists.
* SEO title and meta description per translation, stored in WakaLang-owned post meta and passed to WordPress core and the Yoast / Rank Math public filters (their own meta is never read or written).
* Per-language site title and tagline translation (overriding `option_blogname` / `option_blogdescription` on the front end without going through gettext).
* Admin locale follows the URL language via `determine_locale`.
* Admin post-list language filtering and an untranslated-coverage report on the Tools screen, alongside rewrite flush, relationship/orphan checks and settings export/import.
* Markdown Renderer for GitHub cooperation: WakaLang owns the site-wide language spine and suppresses GFMR's own switcher via its `gfmr_language_switcher_enabled` hook, avoiding a duplicate switcher.
* Extension API surface for add-ons (the `wakalang_loaded` action and the add-on registry) plus free-edition licensing stubs and a feature gate.
* Plugin bootstrap, activation/deactivation, uninstall handling, a privacy-policy suggestion, and full internationalization (bundled `.pot` + Japanese `.po`/`.mo` and block-editor JS translations).
