Adds the alinio translation widget to all pages of the website. The widget translates the content and shows a language switcher.
The widget is part of the plugin and asks the website itself, which passes the request on to alinio. The secret key of the website stays on the server, and the browsers of the visitors never connect to alinio: no IP address, user agent or cookie of a visitor reaches alinio.
For privacy the widget can be loaded only after a visitor chooses a language, optionally after a notice about the external service (setting "Load on request").
The plugin needs an account at the alinio translation service, see External services below.
Content marked with translate="no" or the class notranslate stays untranslated.
Settings:
- Enable alinio: Adds the widget script to the head of every frontend page.
- Load on request: "Off" loads the widget on every page. "Load on click" shows the language switcher with the website's languages and loads the widget only when a visitor chooses a language there, clicks an element with data-alinio-lang or opens a link with ?alinio_lang=. After that the widget is loaded on every page for this visitor until the original language is chosen again. "Load on click and confirmation" first shows a notice that the external service alinio is used, and loads the widget only when the visitor agrees. Browser language detection in the alinio dashboard only applies once the widget is loaded.
- Personal pages: No widget for logged-in users and on the WooCommerce cart, checkout and account pages. These pages can show names, addresses and orders. Developers can mark other pages with the filter alinio_personal_page, e.g.
add_filter('alinio_personal_page', fn ($personal) => $personal || is_page('members'));.
- Secret Key: The secret key from the Plugins box of the website in the alinio dashboard. Without a secret key no widget is added. The key stays on the server and never appears in a page. When the settings are saved, alinio checks the key: the settings page names the alinio website of the key and lists its languages below the key. It tells why alinio rejects a key (unknown key, the site key of the script tag instead of the secret key, paused website) and warns if the key belongs to an alinio website at another domain. The key is saved in any case. While visitors use the language switcher, the plugin loads them again at most every 5 minutes.
- Language Switcher: Where the language switcher appears (bottom right, bottom left, top right, top left, inline or none). Leave it at "Setting of the alinio dashboard" to use the position configured there. Inline shows the switcher above the content, None hides it.
- Container: Optional CSS selector, e.g. #language. The language switcher is shown inside this element instead of floating.
The inline language switcher is placed at the top of the page with the wp_body_open hook. Themes that do not call wp_body_open can use the Container setting instead.
The admin bar is marked translate="no".
The widget calls the REST endpoint /wp-json/alinio/v1/proxy of the website. The endpoint answers only requests of the website itself and accepts 60 translation requests per minute from one visitor. Developers can change the limit with the filter alinio_visitor_limit (0 turns it off, e.g. behind a proxy that hides the IP addresses of the visitors) and the allowed hosts with the filter alinio_allowed_hosts.
The plugin adds a suggested text for the website's privacy policy to the Privacy Policy Guide under Settings / Privacy. It links the alinio website and its privacy policy (
alinio.de for a German user interface).