Datoden Language Switcher

Description

In the WordPress admin the plugin is shown as “DT-language” in the DT-addons menu (Datoden’s menu).

DT-language puts your website in two languages: the main language on the website’s usual address and one more language on its own address on the same domain (for example /en/).

  • Two languages: the main language and a second language with its own address on the same domain (/en/).
  • Pages are linked to their translations. Click + EN next to a page in the page list: a copy opens, ready to be translated.
  • The page and post lists show the language of every page, can be filtered by language and show a page and its translations in consecutive rows.
  • The start page, the sections on it, the contact page, the privacy page and placed DT-slideshow slideshows follow the language automatically.
  • Menus follow the language: pages in the menu go to their translations.
  • Language switcher (SV / EN) last in the menu, where the theme puts it, or the shortcode [datoden_language_switcher].
  • hreflang links for search engines, the right language in and WordPress’ own texts in the visitor’s language.
  • A page opened on the wrong language address is redirected to the right one.
  • DT-contact forms are shown in the visitor’s language, and their texts are written per language in DT-contact.
  • No extra tables, nothing loaded from other servers.

For themes and plugins

  • apply_filters(‘datoden_lang_id’, $page_id) gives the page in the visitor’s language.
  • do_action(‘datoden_language_switcher’) prints the language switcher where the theme wants it (with add_theme_support(‘dt-language-switcher’)).
  • Filters for own addresses per language (datoden_lang_path), language-neutral pages shown in both languages (datoden_lang_neutral_post), own hreflang addresses (datoden_lang_alternates) and translation of whole pages with a dictionary (datoden_lang_dictionary, datoden_lang_translate_output, datoden_lang_output).
  • REST: POST /wp-json/datoden-language/v1/translation creates or updates a translation (for editors who may edit the page).

Pro add-on

In the separate paid add-on Datoden Language Switcher Pro (from Datoden, not on WordPress.org): more than two languages, an own domain per language, an own menu per language, translation of the theme’s texts, the site title and the menu labels in Customize, translation of the slideshows’ texts in DT-slideshow, and changing any text directly on the website. DT-language works fully without it.

External services

This plugin can connect to Datoden (https://datoden.com), a service run by Responsit AB, Sweden. The connection is optional – everything in the plugin works without it. Nothing is sent to Datoden until an administrator clicks “Start DT-website-guard” (or “Connect”) in the WordPress admin and approves the connection on datoden.se or datoden.com. You can disconnect at any time with “Disconnect” (or by turning DT-website-guard off) on the DT-website-guard page; then nothing more is sent.

What is sent to Datoden, and when (only while the website is connected, except the connection itself):

  • When you connect: the website address, the administrator’s language (Swedish or English), the WordPress address that Datoden returns to and a random check value. After you approve on Datoden, the website sends the one-time code it got back, together with the website address and the language, and receives a website key that is stored in your database.
  • Once a day (WordPress cron), and when an administrator opens a DT plugin page and the last contact is more than six hours old: the website key, the language, and the folder names, versions and active state of the installed Datoden plugins (for example datoden-cookie-consent). The answer can contain short messages from Datoden and updated wording for the DT plugins’ texts, which are shown on the plugins’ pages.
  • When an administrator opens the DT-website-guard page or a DT plugin page (at most every five minutes), or clicks “Check again”: the website key, to get the latest result of Datoden’s monitoring (up or down, response time, and the expiry dates of the SSL certificate and the domain). “Check again” also asks Datoden to check the website once more.
  • When the DT-website-guard page is shown and the DT-website-guard plugin is installed: the list of Datoden’s plugins and their versions is fetched from datoden.se, at most every six hours. No data about the website is sent.
  • When you click “My websites”: the website key, the language and the email address of the logged-in WordPress user, so that Datoden can sign you in directly if it is the same address as your Datoden account.
  • When you save, use or delete a settings profile: the website key, and when saving the settings of DT-cookie and DT-darkmode (no personal data; website-specific values such as the logo and the privacy page are left out). They are stored in or read from your Datoden account.
  • When you disconnect: the website key, so that Datoden can remove it.
  • While connected, Datoden visits the public website every five minutes (like any visitor) to check that it is up, reads its SSL certificate and looks up the domain’s public registration data to find when it expires. The plugin shows the dates as Datoden reports them; the website does not contact any other service for this.

Datoden terms: https://datoden.com/terms/
Datoden privacy policy: https://datoden.com/privacy-policy/

Source code

Everything in this plugin is the original, human-readable source code. The PHP, JavaScript and CSS files are written by hand and are neither minified nor generated by a build tool, so there is no build step: the files in the plugin folder are the source and can be read and edited directly.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Datoden Language Switcher” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

3.0.17

The REST endpoint /translation (create or update a translation) checks permissions for every post involved: editing the source and the original, editing an existing translation (before, only the source post was checked) or creating posts of the type, and publishing the post type when the translation is published. The language must exist on the site and the parameters have declared types. The Create translation button uses the same check, and the language fields (_datoden_lang, _datoden_lang_of) can only be changed by users who may edit that post.