Browse Source

Consistent html lang attribute

Sergio Brighenti 6 years ago
parent
commit
deab83f737
3 changed files with 10 additions and 2 deletions
  1. 8 0
      app/Web/Lang.php
  2. 1 1
      bootstrap/app.php
  3. 1 1
      resources/templates/base.twig

+ 8 - 0
app/Web/Lang.php

@@ -102,4 +102,12 @@ class Lang
 
 		return $key;
 	}
+
+	/**
+	 * @return string
+	 */
+	public function getLang(): string
+	{
+		return $this->lang;
+	}
 }

+ 1 - 1
bootstrap/app.php

@@ -82,7 +82,7 @@ $container['view'] = function ($container) use (&$config) {
 	$view->getEnvironment()->addGlobal('request', $container->get('request'));
 	$view->getEnvironment()->addGlobal('alerts', Session::getAlert());
 	$view->getEnvironment()->addGlobal('session', Session::all());
-	$view->getEnvironment()->addGlobal('lang', $container->get('lang'));
+	$view->getEnvironment()->addGlobal('current_lang', $container->get('lang')->getLang());
 	$view->getEnvironment()->addGlobal('PLATFORM_VERSION', PLATFORM_VERSION);
 
 	$view->getEnvironment()->addFunction(new Twig_Function('route', 'route'));

+ 1 - 1
resources/templates/base.twig

@@ -1,5 +1,5 @@
 <!doctype html>
-<html lang="en">
+<html lang="{{ current_lang }}">
 <head>
     <title>{% block title %}Default{% endblock %} | {{ config.app_name }}</title>
     <meta charset="utf-8">