Check language in parents directories name

This commit is contained in:
Miraty 2022-01-05 20:11:53 +01:00
parent 7a2272a263
commit 3ece3cbb71
1 changed files with 9 additions and 5 deletions

View File

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