I’ve set up a multisite WordPress installation, because I want to work with multipul languages. Everything work except the lang attribute. I want the admin panel to be English, but I want to give lang attribute the value of the language of the site it self (for example german). The only way I see to that is to change the admin panel to that language.

The code I’m using:

   <html <?php language_attributes(); ?>>

The value I get on the site (with English admin panel):

   <html lang="en_GB">

The value I want to get with the English admin panel:

   <html lang="de">

My site uses a folder for the language not a sub domain. So the German site is: http://localhost/de/

1 Answer
1

This is fixed. I made a small script to get this working.

Because it was a multi language site I just named the site’s to the language they should be in. So the English page is named English, German page is called German etc. Made a small php script to check what the page name is so a variable will fill this one in.

PHP code:

# Check language of page
$currentLang = get_bloginfo(); 

if ($currentLang == 'English') {
   $htmlLang = "en-GB";
}
elseif ($currentLang == 'German') {
   $htmlLang = "de";
}
# etc 

Leave a Reply

Your email address will not be published. Required fields are marked *