=== Lobbit Multilingual ===
Contributors: lobbit, freemius
Tags: multilingual, translation, translate, language switcher, ai translation
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Multilingual site without duplicate pages. Translate by hand or once with AI and your own key: no subscription, translations stay in your site.

== Description ==

Lobbit Multilingual translates what your site shows, as it is sent to the visitor. There are no copies of pages and posts to keep in step: you keep editing your site in its main language, and the other languages follow.

It works with any theme and page builder, because it translates the final page: the block editor, Elementor, GeneratePress and the rest, menus, widgets and the texts of the theme alike.

**One address per language**

* The main language stays at the root of the site: your addresses do not change.
* Every other language lives under its own prefix: `/en/`, `/de/`, `/fr/`…
* The language comes only from the address: visitors are never redirected by the language of their browser, and every language has its own address for search engines.

**Translate once, keep it forever**

* Write the translations by hand, in a simple editor that lists every text of the site.
* Or generate them once with the AI service you prefer, with your own API key: Claude (Anthropic), ChatGPT (OpenAI), Gemini (Google), Grok (xAI) or DeepL. A small site costs a few cents per language, paid to the service directly.
* On WordPress 7.0 and later, a service already connected in Settings → Connectors is used as it is, without entering the key again.
* The translations are saved in your database. Visitors never call the AI service: pages are as fast as before, and nothing is billed per visit or per word.
* A text the service cannot translate is marked, with the reason, and can be retried or written by hand. It is never saved as if it were translated.
* Texts written or corrected by hand are never overwritten.

**Search engines**

* `hreflang` links between the languages of every page, with the main language as `x-default`.
* The `lang` attribute, the canonical address, `og:url` and `og:locale` follow the language of the page; titles, descriptions and the Open Graph texts of Yoast SEO and Rank Math are translated.
* One sitemap per language: in the WordPress sitemap, and in the sitemap index of Yoast SEO and Rank Math.

**Language switcher**

* In your menus: theme menus, the Elementor menu widget, and also themes that print the menu links themselves. In a row, or as a dropdown that uses the submenus of the theme; with flag, code, name, or flag and code, while colors and fonts stay those of the theme.
* As a floating button in one of the four corners of the page, at the distance you choose. At the top it moves under the header when the header would be covered.
* As a block, or with the shortcode `[lobbit_ml_switcher]` (`style="list"` for a row, `style="dropdown"` for a dropdown).
* Its look is yours, with a live preview: flag, code (IT, EN), name of the language, or flag and code; the flag of each language (English with the flag of the United Kingdom or of the United States, Spanish with Spain or Mexico…); background, text and border colors; rounded corners, from square to pill; small, medium or large; shadow; languages in a row or a dropdown that opens on click and works with the keyboard.
* Flags are images inside the plugin, never emoji: they look the same on every device, Windows included.

**What is translated**

Paragraphs, headings, menus, buttons and every visible text, with links and bold words kept inside their sentence; the alternative text and title of images; form placeholders and buttons; the title of the page and the meta descriptions for search engines and social networks.

Scripts, styles, code and every element marked `translate="no"` or with the class `notranslate` are left as they are.

**Free and Pro**

The free version is complete: every feature above, in as many languages as you want, translated by hand or with AI. Lobbit Multilingual Pro, available on the website of the developer, adds translated addresses (`/en/about-us/` instead of `/en/chi-siamo/`, for pages, posts and categories), the glossary (terms never translated, or always translated the same way) and support by the developer.

**Credits**

Flags from [flag-icons](https://github.com/lipis/flag-icons) by Panayiotis Lipiridis, MIT license (see `assets/flags/LICENSE-flag-icons.txt`). Spain and Serbia use their civil flags.

== Installation ==

1. Install and activate the plugin. The main language is set to the language of your WordPress.
2. Go to Settings → Multilingual, Languages tab, and add a translation language.
3. In the Translations tab, press "Scan the site": the plugin reads your pages and lists their texts.
4. Translate: with an AI service (AI service tab, with a guide to get the key of each service) or by hand, in the list.
5. Check the language at `/en/` (or its prefix) while logged in, then make it public in the Languages tab and add the switcher to a menu.

== Frequently Asked Questions ==

= Does the plugin slow down my site? =

No AI service is called when a visitor opens a page. The plugin reads the translations of the page from the database with one query and puts them in the page. Page caches keep working: every language has its own addresses.

= What happens when I change a text of a page? =

The changed text is a new text for the plugin: the page shows it in the main language until it is translated. Scan the site again, or open the page in the other language while logged in, and translate the new texts.

= Where is my API key kept? =

In the settings of the plugin, in your database, and it is used only from the settings page. You can keep it out of the database with a constant in `wp-config.php`, for example `define( 'LOBBIT_ML_KEY_CLAUDE', '…' );` (also `LOBBIT_ML_KEY_OPENAI`, `LOBBIT_ML_KEY_GEMINI`, `LOBBIT_ML_KEY_GROK`, `LOBBIT_ML_KEY_DEEPL`).

= Can I use the Connectors of WordPress? =

Yes. Since WordPress 7.0, Settings → Connectors keeps one key per AI service for all the plugins of the site. When the chosen service (Claude, OpenAI, Gemini or Grok, each with the plugin of the service) is connected there, Lobbit Multilingual uses that connection and needs no key of its own. You can turn this off in the AI service tab. DeepL has no connector and always uses the key saved in the plugin.

= How many languages can I add? =

As many as you want, in the free version too. Each one lives under its own prefix and can be checked by administrators before it is made public.

= Are the addresses of the pages translated too? =

In the free version every language keeps the slugs of the main language under its prefix: `/en/chi-siamo/`. Lobbit Multilingual Pro gives pages, posts and categories a slug of their own in every language, `/en/about-us/`, and redirects the old address to it.

= Can I change the main language later? =

Yes, with a confirmation: the translations are made from the texts of the main language, so the existing ones no longer apply. They stay in the database and come back if you choose that language again.

= What happens when I delete the plugin? =

Its tables (texts and translations) and its settings are removed. Deactivating it keeps everything.

= Can I use flags in a theme that prints the menu itself? =

Yes. The language items of the menu carry a mark at the end of their address, and the plugin turns those links into switcher links with the flag. With the dropdown chosen, the plugin puts its own dropdown in place of the language links, with the colors, fonts and spacing of the links of the theme and the background of its header; in the menu of a phone it opens as an accordion. No change to the theme is needed.

= Do I have to create an account or share data to use the plugin? =

No. On activation the plugin asks whether you want to receive security and feature updates and share some non-sensitive data about your site through Freemius. It is optional: press "Skip" and every free feature keeps working, with nothing sent. The free version never checks a license.

== External services ==

The plugin connects to an external service only when you ask it to translate from the settings page, and only to the service you chose. It sends the texts of your site to translate, in the main language, together with your API key. Nothing is sent when visitors browse the site.

* Claude, by Anthropic: https://api.anthropic.com. Terms: https://www.anthropic.com/legal/commercial-terms. Privacy: https://www.anthropic.com/legal/privacy
* OpenAI: https://api.openai.com. Terms: https://openai.com/policies/terms-of-use/. Privacy: https://openai.com/policies/privacy-policy/
* Gemini, by Google: https://generativelanguage.googleapis.com. Terms: https://ai.google.dev/gemini-api/terms. Privacy: https://policies.google.com/privacy
* Grok, by xAI: https://api.x.ai. Terms: https://x.ai/legal/terms-of-service. Privacy: https://x.ai/legal/privacy-policy
* DeepL: https://api.deepl.com and https://api-free.deepl.com. Terms: https://www.deepl.com/pro-license. Privacy: https://www.deepl.com/privacy

The scan of the site requests the pages of your own site, from your server.

The plugin includes the Freemius SDK, which handles the optional opt-in, the upgrade to Pro and the Pro license. Freemius is contacted only when you opt in on activation, open the upgrade or account pages of the plugin, activate a Pro license, or send the optional feedback form when deactivating; it then receives the data shown on that screen (such as the address of your site, the versions of WordPress, PHP and the plugin, and your email address when you opt in). Freemius: https://freemius.com. Terms: https://freemius.com/terms/. Privacy: https://freemius.com/privacy/

== Screenshots ==

1. Translations: collect the texts of the site, translate the missing ones with AI or by hand, then check and correct them.
2. AI service: Claude, OpenAI, Gemini, Grok or DeepL, with the cost for a small site and how to get the key; or the Connectors of WordPress.
3. Languages: the main language at the root of the site, the translation languages under their prefix, public or in preview.
4. Switcher: where it shows up, flags, colors and shape, with a live preview.
5. The site in English under /en/, with the language dropdown in the menu of the theme.

== Changelog ==

= 2.0 =
* Pro: the plugin icon shows up in the list of updates, instead of the generic plug.

= 1.9 =
* The address of the request is unslashed and cleaned with `esc_url_raw()` before the plugin reads it.
* Settings page: every array read from the form is sanitized as soon as it is read.

= 1.8 =
* The page is translated in the template output buffer of WordPress 6.9 and later. Where that buffer does not run (older WordPress, or Elementor, which turns it off) the plugin opens its own buffer around the template and closes it right after.

= 1.7 =
* Pro: translated addresses. Pages, posts and categories can have their own slug in every language (`/en/about-us/` instead of `/en/chi-siamo/`), chosen in the editor, in the edit form of the category or in the new Addresses tab, which can fill the empty slugs from the translated titles. Links, the switcher, hreflang, the canonical address, `og:url` and the sitemaps use them, and the old address is redirected (301), also after a translated slug is changed.

= 1.6 =
* No limit on languages: the free version translates into as many languages as you want.
* Services connected in Settings → Connectors are checked through the AI client of WordPress.

= 1.5 =
* Freemius SDK updated to 2.13.5.

= 1.4 =
* First release on WordPress.org.
* Clearer upgrade notes: Pro adds unlimited languages, the glossary and support by the developer.

= 1.3 =
* Lobbit Multilingual Pro can be bought and activated: licensing through Freemius. When a Pro license expires its features keep working; only updates and support stop.
* The free version works on its own: the Freemius opt-in on activation can be skipped and no license is checked.
* Installing Pro deactivates the free version automatically: settings and translations carry over.

= 1.2 =
* Switcher in the menu with settings of its own: what it shows (flag, code, name, flag and code) and how (row, or a dropdown in the submenu of the theme).
* Flags and the dropdown also in themes that print the menu links themselves, with no change to the theme.
* Sturdier look in every theme: flags and the dropdown arrow keep their size.
* Floating button at the top: moves under the header when the header would be covered.

= 1.1 =
* New plugin icon.
* The language switcher shows up in the chosen menus also when the theme prints the menu links itself, without `wp_nav_menu()`.
* Links printed one after the other (a menu without list items) are translated one by one, so a menu item has the same translation on every page.
* New "Look of the switcher" settings with a live preview: flag, code, name or flag and code; the flag of each language; colors; rounded corners; size; corner and distance of the floating button; shadow; row or dropdown. All in the free version.

= 1.0 =
* First version: main language at the root and prefixes for the other languages, translation of the final page (block editor, Elementor, GeneratePress), editor of the texts, generation with Claude, OpenAI, Gemini, Grok or DeepL with your own key, hreflang and sitemaps (WordPress, Yoast SEO, Rank Math), language switcher (menus, floating button, block, shortcode), glossary (Pro).
