Web

Separated Multilingualism: Divide and Conquer

A bird with glasses reading a dictionary

I had set up my old site, fodina.de bilin­gual. With the help of WP-Globus. As nice as this worked for years, at last WP-Globus got lost. Thor­ough­ly! When I edit­ed the Ger­man text, it made the Eng­lish dis­ap­pear. And vice ver­sa. Some­thing like that shall not hap­pen to me again. The restora­tion was com­plex and com­pli­cat­ed. So, while migrat­ing to bootScore, I switched to a sep­a­rat­ed mul­ti­lin­gual­ism — real­ized by two sep­a­rate sites.

karsten-reincke.de is a Ger­man lan­guage site, fodina.de an Eng­lish. Now there’s no need any­more to trans­late all con­tri­bu­tions alter­nate­ly. That is unnec­es­sary for those, which address only Ger­man-speak­ing read­ers. Addi­tion­al­ly, this tech­nique opens the­mat­ic free­dom: one (fodina.de) focus­es on FOSS, and the oth­er (karsten-reincke.de) also talks about my oth­er Ger­man life.1

How­ev­er, the pages of my pairs shall still refer to each oth­er. So I need an inde­pen­dent eas­i­ly to insert lan­guage ‘switch­er’. In oth­er words: a short­code. Maybe you will also need such a thing some­times

[ en | de ]

Solution

  • Add the fol­low­ing code to functions.php of your child theme:
/*
 * (c) 2023 Karsten Reincke
 * SPDX-License-Identifier: MIT
 */
function switch_fromto($atts){
  $toSite="http://woimmer.de/mywp.toLang";
  $atts = (array) $atts;
  $fromLang=$atts[0];
  $toLang=$atts[1];
  $toPage=$atts[2];
  $lsw= '<div class="text-right">[ ' . $fromLang . ' | <a href="' 
    .$toSite . "/". $toPage . '">'. $toLang . '</a> ]</div>';
  $res=
  '<div class="container">' .
    '<div class="d-flex justify-content-end sample-row">' .
      '<div class="col-xs">' . 
        $lsw .
    '</div></div></div>';
  return $res;
}
add_shortcode('fromto', 'switch_fromto');
  • Adjust woimmer.de/mywp.toLang to your real­i­ty.
  • Add
    [ de | en ]
    on the Ger­man page of the pair and
    [ en | de ]
    on Englisch.

Background

Plu­g­ins for mul­ti­lin­gual sites actu­al­ly always work the same way. Pages and posts exist inter­nal­ly in two ver­sions. WP-Globus put all vari­ants into the same data­base entry, sep­a­rat­ed with mark­ers {:de}...{:}{:en}...{:}. The rest is opti­cal sug­ar that the plu­g­in puts over it. That’s why these plu­g­ins can and must also include a lan­guage chang­er that is geared to their own kind, which the site admin­is­tra­tor can have inte­grat­ed into the menu.

If the mul­ti-lan­guage plu­g­in gets lost, how­ev­er, you are in trou­ble. After all, access to the indi­vid­ual lan­guage sec­tions is only pos­si­ble via the plu­g­in itself any­way. There­fore, the safe option is to work with two sep­a­rate sites. The over­head of main­te­nance out­weighs reli­a­bil­i­ty.


And how does this …

… sup­port our migra­tion to bootScore? Well, if a web design­er must aban­don her cur­rent Word­Press theme, she needs a replace­ment. A free ‘off-the-shelf’ theme, she prob­a­bly wants to per­son­al­ize. First a bit cos­met­i­cal­ly, then in terms of the gray val­ue of her pages, mul­ti­lin­gual­ism and inter­nal ref­er­ence tech­niques and link­ing. Final­ly, she per­haps enables spe­cial foot­ers, a sec­ondary menu or a copy­right notice before check­ing the SEO fea­tures of the select­ed theme. This is a way that this post sup­ports too.


  1. But this sep­a­ra­tion needs a more sophis­ti­cat­ed stag­ing. []
To top