[feature] Set/show instance language(s); show post language on frontend (#2362)

* update go text, include text/display

* [feature] Set instance langs, show post lang on frontend

* go fmt

* WebGet

* set language for whole article, don't use FA icon

* mention instance languages + other optional config vars

* little tweak

* put languages in config properly

* warn log language parse

* change some naming around

* tidy up validate a bit

* lint

* rename LanguageTmpl in template
This commit is contained in:
tobi 2023-11-17 11:35:28 +01:00 committed by GitHub
commit fc02d3c6f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 55005 additions and 141 deletions

View file

@ -398,12 +398,27 @@ main {
border-top: 0.15rem solid $toot-info-border;
padding: 0.5rem 0.75rem;
div, time {
time {
padding-right: 1rem;
}
.stats {
display: flex;
display: inline-flex;
flex: 1;
gap: 1rem;
.stats-item {
span {
white-space: nowrap;
}
}
.language {
margin-left: auto;
z-index: 1;
cursor: pointer;
user-select: none;
}
}
grid-column: span 3;

View file

@ -25,6 +25,22 @@
{{.instance.Description |noescape}}
</div>
<div>
<h2 id="languages">Languages</h2>
<p>
{{ if .languages }}
This instance prefers the following languages:
<ol>
{{range .languages}}
<li>{{.}}</li>
{{end}}
</ol>
{{ else }}
This instance does not have any preferred languages.
{{ end }}
</p>
</div>
<div>
<h2 id="contact">Admin Contact</h2>
{{if .instance.ContactAccount}}
@ -81,7 +97,7 @@
<div>
<h2 id="moderated-servers">Moderated servers</h2>
<p>
ActivityPub instances exchange (federate) data with other servers, including accounts and toots.
ActivityPub instances exchange (federate) data with other instances, including accounts and toots.
This can be prevented for specific domains by suspending them. None of their content is stored,
and interaction with their users is blocked both ways.</br>
{{if .blocklistExposed}}

View file

@ -36,15 +36,15 @@
{{if .SpoilerText}}
<details class="text-spoiler">
<summary>
<span class="spoiler-text">{{emojify .Emojis (escape .SpoilerText)}}</span>
<span class="spoiler-text" lang="{{ .LanguageTag.TagStr }}">{{emojify .Emojis (escape .SpoilerText)}}</span>
<span class="button" role="button" tabindex="0">Toggle visibility</span>
</summary>
<div class="content">
<div class="content" lang="{{ .LanguageTag.TagStr }}">
{{emojify .Emojis (noescape .Content)}}
</div>
</details>
{{else}}
<div class="content">
<div class="content" lang="{{ .LanguageTag.TagStr }}">
{{emojify .Emojis (noescape .Content)}}
</div>
{{end}}
@ -113,30 +113,29 @@
<aside class="info">
<time datetime="{{.CreatedAt}}">{{.CreatedAt | timestampPrecise}}</time>
<div class="stats" role="group">
<div>
<span aria-hidden="true">
<i class="fa fa-reply-all"></i> {{.RepliesCount}}
</span>
<div class="stats-item">
<span aria-hidden="true"><i class="fa fa-reply-all"></i> {{.RepliesCount}}</span>
<span class="sr-only">{{.RepliesCount}} {{if .RepliesCount | eq 1}}reply{{else}}replies{{end}}</span>
</div>
<div>
<span aria-hidden="true">
<i class="fa fa-star"></i> {{.FavouritesCount}}
</span>
<div class="stats-item">
<span aria-hidden="true"><i class="fa fa-star"></i> {{.FavouritesCount}}</span>
<span class="sr-only">{{.FavouritesCount}} favourite{{if .FavouritesCount | eq 1 | not}}s{{end}}</span>
</div>
<div>
<span aria-hidden="true">
<i class="fa fa-retweet"></i> {{.ReblogsCount}}
</span>
<div class="stats-item">
<span aria-hidden="true"><i class="fa fa-retweet"></i> {{.ReblogsCount}}</span>
<span class="sr-only">{{.ReblogsCount}} boost{{if .ReblogsCount | eq 1 | not}}s{{end}}</span>
</div>
{{if .Pinned}}
<div>
<i class="fa fa-thumb-tack" aria-hidden="true"></i>
<span class="sr-only">pinned</span>
</div>
<div class="stats-item">
<i class="fa fa-thumb-tack" aria-hidden="true"></i>
<span class="sr-only">pinned</span>
</div>
{{end}}
{{ if .LanguageTag.DisplayStr }}
<div class="stats-item language" title="Language: {{ .LanguageTag.DisplayStr }}">
{{ .LanguageTag.TagStr }}
</div>
{{ end }}
</div>
</aside>
<a data-nosnippet href="{{.URL}}" class="toot-link">Open