I had set up my old site, fodina.de bilingual. With the help of WP-Globus. As nice as this worked for years, at last WP-Globus got lost. Thoroughly! When I edited the German text, it made the English disappear. And vice versa. Something like that shall not happen to me again. The restoration was complex and complicated. So, while migrating to bootScore, I switched to a separated multilingualism — realized by two separate sites.
karsten-reincke.de is a German language site, fodina.de an English. Now there’s no need anymore to translate all contributions alternately. That is unnecessary for those, which address only German-speaking readers. Additionally, this technique opens thematic freedom: one (fodina.de) focuses on FOSS, and the other (karsten-reincke.de) also talks about my other German life.1
However, the pages of my pairs shall still refer to each other. So I need an independent easily to insert language ‘switcher’. In other words: a shortcode. Maybe you will also need such a thing sometimes
Solution
- Add the following 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 reality.
- Add
on the German page of the pair and[ de | en ]
on Englisch.[ en | de ]
Background
Plugins for multilingual sites actually always work the same way. Pages and posts exist internally in two versions. WP-Globus put all variants into the same database entry, separated with markers {:de}...{:}{:en}...{:}
. The rest is optical sugar that the plugin puts over it. That’s why these plugins can and must also include a language changer that is geared to their own kind, which the site administrator can have integrated into the menu.
If the multi-language plugin gets lost, however, you are in trouble. After all, access to the individual language sections is only possible via the plugin itself anyway. Therefore, the safe option is to work with two separate sites. The overhead of maintenance outweighs reliability.
And how does this …
… support our migration to bootScore? Well, if a web designer must abandon her current WordPress theme, she needs a replacement. A free ‘off-the-shelf’ theme, she probably wants to personalize. First a bit cosmetically, then in terms of the gray value of her pages, multilingualism and internal reference techniques and linking. Finally, she perhaps enables special footers, a secondary menu or a copyright notice before checking the SEO features of the selected theme. This is a way that this post supports too.
- But this separation needs a more sophisticated staging. [↩]