Check language in parents directories name
This commit is contained in:
parent
7a2272a263
commit
3ece3cbb71
1 changed files with 9 additions and 5 deletions
14
mkht.php
14
mkht.php
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue