Hi Stephen.
I guess all multilingual WP sites use a plugin such as WPML, Polylang or similar. Maybe there’s a solution that works for all of them? But it won’t be easy. Apart from the HTML LANG tag, I can’t see any other way to dissociate the language used by the page. Personally, I had to add a filter to add this as a class in the body (add_filter > body_class). Alternatively, with WPML I can manage multilingual display via a function containing the following:
if ( ICL_LANGUAGE_CODE === 'en' ) {
echo = 'English text';
} else {
echo = 'Other language goes here';
}
One approach would be to offer a drop-down list with predefined messages? In that case, po/mo files would suffice to take care of the translation (i18n). But I imagine some users would like a personalized message. Maybe leave the choice to a switch? Either a predefined and translatable list, or a personalized text.
Another option I’ve tried without success is to simply write a shortcode in the child theme’s functions.php to display the message according to the language displayed, but shortcode reading isn’t active in the text fields. But I imagine this solution is a little too technical for most users.
I don’t know, there are probably other (simpler?) solutions, but I don’t see it tbh.
Pierre