Check language in parents directories name

This commit is contained in:
Miraty 2022-01-05 20:11:53 +01:00
parent 7a2272a263
commit 3ece3cbb71

View file

@ -33,7 +33,7 @@ if (!isset($config['centerIndex']))
$config['centerIndex'] = false;
if (!isset($config['defaultLang']))
$config['defaultLang'] = "en";
$config['defaultLang'] = "";
// Less > CSS
@ -160,11 +160,15 @@ foreach ($pages as $page) {
<html lang="<?php
preg_match("#\.([a-zA-Z-]{2,5})\.#", $pathParts['basename'], $lang);
if (isset($lang[1]))
if (isset($lang[1])) {
echo $lang[1];
else
echo $config['defaultLang'];
} else {
preg_match("#/([a-z]{2})(/|$)#", $pathParts['dirname'], $lang);
if (isset($lang[1]))
echo $lang[1];
else
echo $config['defaultLang'];
}
?>">
<head>