FIX: HTML lang attribute expects hyphen instead of underscore

This commit is contained in:
Gerhard Schlager 2018-08-20 13:55:58 +02:00
parent 14af90df5b
commit cc851af750
7 changed files with 8 additions and 10 deletions

View File

@ -177,10 +177,8 @@ module ApplicationHelper
["ar", "ur", "fa_IR", "he"].include? I18n.locale.to_s
end
def user_locale
locale = current_user.locale if current_user && SiteSetting.allow_user_locale
# changing back to default shoves a blank string there
locale.present? ? locale : SiteSetting.default_locale
def html_lang
SiteSetting.default_locale.sub("_", "-")
end
# Creates open graph and twitter card meta data

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="<%= SiteSetting.default_locale %>" class="<%= html_classes %>">
<html lang="<%= html_lang %>" class="<%= html_classes %>">
<head>
<meta charset="utf-8">
<title><%= content_for?(:title) ? yield(:title) : SiteSetting.title %></title>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="<%= SiteSetting.default_locale %>">
<html lang="<%= html_lang %>">
<head>
<meta charset="utf-8">
<title><%= content_for?(:title) ? yield(:title) : SiteSetting.title %></title>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="<%= SiteSetting.default_locale %>">
<html lang="<%= html_lang %>">
<head>
<meta charset="utf-8">
<title><%= content_for?(:title) ? yield(:title) : SiteSetting.title %></title>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<%= SiteSetting.default_locale %>" xml:lang="<%= SiteSetting.default_locale %>">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<%= html_lang %>" xml:lang="<%= html_lang %>">
<head>
<meta http-equiv="Content-type" name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="<%=SiteSetting.default_locale%>">
<html lang="<%= html_lang %>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%= @topic_view.topic.title %></title>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<%= html_lang %>" xml:lang="<%= html_lang %>">
<head>
<meta http-equiv="Content-type" name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">