Use proper lang attributes in htmls
This commit is contained in:
parent
0cc6557716
commit
f63d9b7835
|
@ -25,4 +25,13 @@ defmodule Pleroma.Web.Gettext do
|
||||||
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
||||||
"""
|
"""
|
||||||
use Gettext, otp_app: :pleroma
|
use Gettext, otp_app: :pleroma
|
||||||
|
|
||||||
|
def language_tag do
|
||||||
|
# Naive implementation: HTML lang attribute uses BCP 47, which
|
||||||
|
# uses - as a separator.
|
||||||
|
# https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang
|
||||||
|
|
||||||
|
Gettext.get_locale()
|
||||||
|
|> String.replace("_", "-", global: true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom"
|
<feed xml:lang="<%= Gettext.language_tag() %>" xmlns="http://www.w3.org/2005/Atom"
|
||||||
xmlns:thr="http://purl.org/syndication/thread/1.0"
|
xmlns:thr="http://purl.org/syndication/thread/1.0"
|
||||||
xmlns:georss="http://www.georss.org/georss"
|
xmlns:georss="http://www.georss.org/georss"
|
||||||
xmlns:activity="http://activitystrea.ms/spec/1.0/"
|
xmlns:activity="http://activitystrea.ms/spec/1.0/"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="<%= Pleroma.Web.Gettext.language_tag() %>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui">
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="<%= Pleroma.Web.Gettext.language_tag() %>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><%= @email.subject %></title>
|
<title><%= @email.subject %></title>
|
||||||
|
|
Loading…
Reference in New Issue