=== NabuLingo ===
Contributors: stefanobholz
Tags: translation, multilingual, localization, ai, language switcher
Requires at least: 6.1
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.13.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Translates WordPress pages on demand through the NabuLingo service. Language folders, hreflang, switcher. Website key needed (free key in settings).

== Description ==

**Let your WordPress site speak your visitors' language.**

* Your pages and posts are translated into the languages you choose, and a round language button on every page lets visitors switch.
* Setup takes three steps in *Settings > NabuLingo*: choose your languages, get a free key, done.
* Free plan: 1 language and 5,000 words per month. Paid plans: [nabulingo.com/pricing](https://nabulingo.com/pricing).

**A website key is required.** NabuLingo is a subscription service of OBHOLZ SOLUTIONS (Roding, Germany) for businesses. You can request a free key in the plugin settings (email address, confirmation link). A free key is not possible for local addresses (localhost, IP addresses) or for websites on `*.wordpress.com`. Contact: [hello@nabulingo.com](mailto:hello@nabulingo.com).

When a visitor opens a page in another language, the plugin asks the external NabuLingo service (https://nabulingo.com) for the missing translation and stores finished ones in your WordPress database. Details: External Services and the questions below.

== External Services ==

This plugin connects to the **NabuLingo service**, a JSON API run by OBHOLZ SOLUTIONS as a Cloudflare Worker at `nabulingo-worker.stefan-obholz.workers.dev` (no public landing page, only API endpoints under `/v1/`). Nothing is sent until an administrator has saved a website key and a target language, except the free-key request below.

* Translation requests send eligible page text (including approved comments, navigation labels and accessible labels), your website key, source and target languages, and request settings. The User-Agent identifies the plugin and WordPress version. Names from your list of protected names are replaced by neutral markers before sending. Corrections are never sent. This happens when a visitor opens a page in a target language whose translation is missing, during background translation, and on an authorized REST request (server to server; the visitor's IP address is not forwarded).
* Free-key request (only when an administrator clicks *Request free key* and accepts the terms): the plugin sends the email address typed in, the host name of your website, the source language and the first target language to `POST /v1/free/request`. The service sends a confirmation email; the key is created only after the link in that email is used and shown once on the page that opens.
* Only with the optional "Multilingual SEO" setting on: the plugin also checks support for confirmed translations on eligible language pages (the answer is kept for a few minutes): it sends the website key and standard WordPress HTTP metadata (which can include the site's address and WordPress version), no page text.
* REST endpoint `POST /wp-json/nabulingo/v1/translate`: only for logged-in users who may edit posts (visitors get 401, subscribers 403). It sends the text supplied by the caller (at most 8,192 bytes, one configured target language), your website key and the languages to the service and returns the translation. It reads no page on its own.
* The language button is a script that ships inside the plugin (`assets/nabulingo-embed.js`, the NabuLingo embed script in its "routes" mode). It only leads visitors to the language addresses of the same page that the plugin writes into the page; it sends nothing to NabuLingo, sets no cookie and loads nothing from another server. It contains code for another mode (translation in the browser with a key) that the plugin never switches on.
* The service passes text to an AI translation provider. New WordPress websites are translated through Anthropic; the privacy policy lists all providers.
* Service: https://nabulingo.com
* Terms of Service: https://nabulingo.com/legal/terms
* Privacy Policy: https://nabulingo.com/legal/website-privacy

== Installation ==

1. Install and activate the plugin.
2. Open *Settings > NabuLingo*. The page has three steps.
3. Step 1: choose the language of your website and the languages to translate into, and save.
4. Step 2: request a free key, open the link in the email, confirm, copy the key shown on the page that opens, paste it, and save. Or paste a key you already have.
5. Step 3: choose place and color of the language button (on for new installations). Instead of the button you can put a list of languages into a page, widget area or menu with `[nabulingo_lang_switcher]` (see Advanced settings).

== Frequently Asked Questions ==

= What exactly does the plugin do? =
It translates the finished page (visible text, titles, menus, widgets, footer, browser title, and the `alt`, `title`, `placeholder`, `aria-label` and `aria-valuetext` attributes); code and anything marked `translate="no"` stay as they are. Every language gets an address of its own: a folder (`example.com/fr/about/`) on new installations, or the parameter `?nabu_lang=fr` (sites updated from 0.10.x keep it until they switch). The plugin writes `hreflang` and canonical links, and with folders WordPress sitemaps can list finished language versions. If a translation is unavailable, the text stays in the source language (waiting time at most about 3.5 seconds per page view).

= What is never sent to the service? =
Pages viewed by logged-in users, private, draft, pending and scheduled posts, password-protected posts, search results, 404 pages and previews show only translations that already exist. On the WooCommerce cart, checkout, order confirmation and My Account only texts that are the same for every visitor (labels, buttons) are sent, never customer data or anything a visitor typed. A page that answers a form sends nothing. The plugin sets no cookies of its own and does no tracking.

= What is not translated? =
Text created by JavaScript after the page has loaded, form field values, text inside images and feeds. The optional "Multilingual SEO" setting (off by default) translates selected search and social metadata on supported public pages, but only when the NabuLingo service offers this for your website. As long as it does not, your pages are translated as if the setting were off, without the extra metadata.

= Does it translate all pages in advance? =
Only when you ask for it. Tick the box under "Translate in advance" when you save a new language, or press "Translate all pages now". Both use words of your monthly allowance, also for pages nobody has visited yet (up to 5,000 words; in the free plan that is a whole month). Adding a language never starts it by itself. The separate switch "Translate new and changed pages in the background" is off on new installations; updated sites keep their setting.

= Where are translations stored? =
In a table of your own WordPress database (`nabulingo_cache`). Deleting the plugin removes the table and all settings. If the service cannot be reached, missing text stays in the language of your website and administrators see the reason.

= How do I correct a translation or keep a name untranslated? =
Open *Tools > NabuLingo translations* (or "Edit translation of this page" in the admin bar), pick the language, change the text, save. A correction costs no words and is never replaced by the service. Administrators keep the protected names on the same screen.

= Does it work with WooCommerce? =
Tested with WooCommerce 11.3 and Twenty Twenty-Five: shop, product pages, cart, checkout, order confirmation and My Account (classic pages) are translated. Texts that the browser creates (cart and checkout blocks) show the page language only with the WordPress language pack of that language (*Settings > General > Site Language*, then *Dashboard > Updates > Update translations*). Everything a customer typed stays as it is. Other shop systems were not tested.

= Does it work with Polylang or WPML? =
Not together. With Polylang, WPML, TranslatePress or Weglot active, a warning appears and NabuLingo writes no hreflang links (tested with Polylang only).

= Which address format should I use? =
Folders (`/fr/about/`): every language has a clean address. A page with the slug `fr` cannot be opened then. Change the format once and stay with it: browsers remember permanent redirects.

= Does it work with page caches? =
Yes. A page cache keeps one copy per language; unfinished pages are not stored. After you save a correction or the NabuLingo settings, NabuLingo asks WP Super Cache, W3 Total Cache, LiteSpeed Cache and WP Fastest Cache to empty their page cache (W3 Total Cache keeps the old copy up to 30 more seconds); after you change a published page they forget its language addresses. With another page cache, empty it yourself. Tested with WP Super Cache 3.1.5, W3 Total Cache 2.11.0, LiteSpeed Cache 7.9.3 (OpenLiteSpeed) and WP Fastest Cache 1.5.5. With WP Fastest Cache use language folders.

== Screenshots ==

1. A page with the round language button; the list of languages is open.
2. Step 1 of the settings: choose the language of your website and the languages to translate into.
3. Step 2: get a free key or paste your own.
4. Step 3: everything is set up; place and color of the language button, your plan, translating in advance.
5. The settings on a phone.

== Changelog ==

= 0.13.0 =
* New: a round language button on every page (six places, ten colors or a hex value). The script ships inside the plugin. On for new installations, off after an update.
* Changed: the settings page is a short guide in three steps (languages, website key, done) with one Save button. The language of the website is a list of names, the saved key is never written into the page (a tick box removes it), and rarely needed settings (service address, language addresses, search engine data, shortcode) are under "Advanced settings". Messages about the service no longer show HTTP codes (only the explanation of the address format under Advanced settings names the redirect type); the message about a used-up allowance points to your account. "Your plan" links to your account.
* Changed: translating all pages in advance starts only when you tick a box in the save that adds a language, or press the button; adding a language never starts it by itself (before, with the switch on, a new language queued all pages). New and changed pages are handled as before on updated sites; a new installation has that switch off. New installations take the source language from the WordPress language, or ask you to choose.
* Changed: the note about a missing WordPress language pack appears only with WooCommerce, in one sentence.
* Fixed: with "Search engines" (Multilingual SEO) on, language pages are translated the normal way when the NabuLingo service does not offer the extra search metadata for your website (before, the whole site stayed in the source language). The service is asked at most every five minutes.
* Fixed: a saved correction and saved settings empty the page cache of WP Super Cache, W3 Total Cache, LiteSpeed Cache and WP Fastest Cache; a changed published page clears its language addresses there.
* Fixed: the language switcher no longer repeats the tracking parameters (utm_*, gclid, fbclid) of the first visitor to later visitors on a page cache that leaves them out of its cache key.
* Fixed: WP Fastest Cache is emptied once after the plugin version changes; deleting the plugin also removes the record of "Multilingual SEO"; Rank Math forgets its cached sitemaps when the languages change; `aria-valuetext` is translated.
* Unchanged: addresses, the code of the requests to the service, the database layout.

Older versions: `changelog.txt` in the plugin folder.

== Upgrade Notice ==

= 0.13.0 =
New settings page in three steps. Translating all pages in advance now needs a tick in the save that adds a language, or the button (it uses your word allowance); new and changed pages work as before. The saved key is no longer shown in the page.
