Explorar el Código

Add lang HTML attribute

Alan Lam hace 7 años
padre
commit
a1ec41faa2
Se han modificado 3 ficheros con 12 adiciones y 2 borrados
  1. 9 0
      engine/core.php
  2. 1 1
      views/header.php
  3. 2 1
      views/maintenance_mode.php

+ 9 - 0
engine/core.php

@@ -155,4 +155,13 @@ class Core {
 		return Core::isProduction() ? "img/icon.png" : "img/dev_icon.png";
 		return Core::isProduction() ? "img/icon.png" : "img/dev_icon.png";
 	}
 	}
 
 
+	public static function getLocale(): string {
+		return Core::$user->locale ?? LOCALE;
+	}
+
+	public static function getLang(): string {
+		$parts = explode("_", Core::getLocale());
+		return $parts[0];
+	}
+
 }
 }

+ 1 - 1
views/header.php

@@ -8,7 +8,7 @@ if($print) $body_class = "print";
 
 
 ?>
 ?>
 <!DOCTYPE html>
 <!DOCTYPE html>
-<html>
+<html lang="<?=htmlspecialchars(Core::getLang())?>">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
 		<meta http-equiv="x-ua-compatible" content="ie=edge" />
 		<meta http-equiv="x-ua-compatible" content="ie=edge" />

+ 2 - 1
views/maintenance_mode.php

@@ -1,4 +1,5 @@
-<html>
+<!DOCTYPE html>
+<html lang="<?=htmlspecialchars(Core::getLang())?>">
 	<head>
 	<head>
 
 
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />