lang attribute for non-english posts

This commit is contained in:
rimu 2024-08-28 19:15:49 +12:00
parent a473e9c55c
commit 5a156f35a7
3 changed files with 6 additions and 4 deletions

View file

@ -13,7 +13,7 @@
<div class="voting_buttons" aria-live="assertive"> <div class="voting_buttons" aria-live="assertive">
{% include "post/_post_voting_buttons.html" -%} {% include "post/_post_voting_buttons.html" -%}
</div> </div>
<h1 class="mt-2 post_title">{{ post.title }} <h1 class="mt-2 post_title"{% if post.language_id and post.language.code != 'en' %} lang="{{ post.language.code }}"{% endif %}>{{ post.title }}
{% if current_user.is_authenticated -%} {% if current_user.is_authenticated -%}
{% include 'post/_post_notification_toggle.html' -%} {% include 'post/_post_notification_toggle.html' -%}
{% endif -%} {% endif -%}
@ -47,7 +47,7 @@
<a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="Go to image"><img src="{{ post.url }}" style="max-width: 100%; height: auto;" /></a> <a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="Go to image"><img src="{{ post.url }}" style="max-width: 100%; height: auto;" /></a>
{% endif -%} {% endif -%}
</div> </div>
<div class="post_body mt-2"> <div class="post_body mt-2"{% if post.language_id and post.language.code != 'en' %} lang="{{ post.language.code }}"{% endif %}>
{{ post.body_html|community_links|safe if post.body_html else '' }} {{ post.body_html|community_links|safe if post.body_html else '' }}
</div> </div>
</div> </div>
@ -65,7 +65,7 @@
<div class="voting_buttons" aria-live="assertive"> <div class="voting_buttons" aria-live="assertive">
{% include "post/_post_voting_buttons.html" -%} {% include "post/_post_voting_buttons.html" -%}
</div> </div>
<h1 class="mt-2 post_title">{{ post.title }} <h1 class="mt-2 post_title" {% if post.language_id and post.language.code != 'en' %}lang="{{ post.language.code }}"{% endif %}>{{ post.title }}
{% if current_user.is_authenticated -%} {% if current_user.is_authenticated -%}
{% include 'post/_post_notification_toggle.html' -%} {% include 'post/_post_notification_toggle.html' -%}
{% endif -%} {% endif -%}

View file

@ -13,7 +13,8 @@
<div class="row post_replies"> <div class="row post_replies">
<div class="col"> <div class="col">
{% macro render_comment(comment) %} {% macro render_comment(comment) %}
<div id="comment_{{ comment['comment'].id }}" class="comment {% if comment['comment'].author.id == post.author.id %}original_poster{% endif %}" role="treeitem"> <div id="comment_{{ comment['comment'].id }}" class="comment {% if comment['comment'].author.id == post.author.id %}original_poster{% endif %}" role="treeitem"
{% if comment['comment'].language_id and comment['comment'].language.code != 'en' %} lang="{{ comment['comment'].language.code }}"{% endif %}>
<div class="limit_height"> <div class="limit_height">
<div class="comment_author"> <div class="comment_author">
{% with collapsed = comment['comment'].score < -10 -%} {% with collapsed = comment['comment'].score < -10 -%}

View file

@ -75,6 +75,7 @@
</div> </div>
{% macro render_comment(comment) -%} {% macro render_comment(comment) -%}
<div id="comment_{{ comment['comment'].id }}" class="comment {% if comment['comment'].score <= -10 -%}low_score{% endif -%} <div id="comment_{{ comment['comment'].id }}" class="comment {% if comment['comment'].score <= -10 -%}low_score{% endif -%}
{% if comment['comment'].language_id and comment['comment'].language.code != 'en' %} lang="{{ comment['comment'].language.code }}"{% endif %}
{% if comment['comment'].author.id == post.author.id -%}original_poster{% endif -%}" aria-level="{{ comment['comment'].depth + 1 }}" role="treeitem" aria-expanded="true" tabindex="0"> {% if comment['comment'].author.id == post.author.id -%}original_poster{% endif -%}" aria-level="{{ comment['comment'].depth + 1 }}" role="treeitem" aria-expanded="true" tabindex="0">
<div class="limit_height">{% if not comment['comment'].author.indexable -%}<!--googleoff: all-->{% endif -%} <div class="limit_height">{% if not comment['comment'].author.indexable -%}<!--googleoff: all-->{% endif -%}
<div class="comment_author"> <div class="comment_author">