Setting correct html lang in header
Permalink
I just updated the Blank HTML5 Boilerplate theme today and added a piece of code that I would like to share here because it might be of general interest. It is used to make sure that the html-lang attribute gets the correct language even if the site uses multiple ones through the "internationalization" add-on. If the add-on is not present or the language is not defined, it falls back to the LANGUAGE constant instead.
Any feedback is apprechiated.
<?php if( Package::getByHandle('multilingual') ) { $mh = Loader::helper('section', 'multilingual'); if ( $lang = $mh->getLanguage() == "") { $lang = LANGUAGE; } } else { $lang = LANGUAGE; }?> <html lang="<?=$lang?>">
Any feedback is apprechiated.