Expose content language in HTML

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-11-13 15:58:54 +01:00
parent cf7744ab51
commit 0a37719029
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
16 changed files with 60 additions and 11 deletions

View file

@ -63,7 +63,12 @@
</button> </button>
</span> </span>
<br /> <br />
<div v-if="!comment.deletedAt" v-html="comment.text" dir="auto" /> <div
v-if="!comment.deletedAt"
v-html="comment.text"
dir="auto"
:lang="comment.language"
/>
<div v-else>{{ $t("[This comment has been deleted]") }}</div> <div v-else>{{ $t("[This comment has been deleted]") }}</div>
<div class="load-replies" v-if="comment.totalReplies"> <div class="load-replies" v-if="comment.totalReplies">
<p v-if="!showReplies" @click="fetchReplies"> <p v-if="!showReplies" @click="fetchReplies">

View file

@ -39,7 +39,12 @@
/> />
</div> </div>
<div class="media-content"> <div class="media-content">
<h3 class="event-title" :title="event.title" dir="auto"> <h3
class="event-title"
:title="event.title"
dir="auto"
:lang="event.language"
>
{{ event.title }} {{ event.title }}
</h3> </h3>
<div class="content-end"> <div class="content-end">

View file

@ -17,7 +17,7 @@
</div> </div>
</div> </div>
<div class="title-info-wrapper has-text-grey-dark"> <div class="title-info-wrapper has-text-grey-dark">
<h3 class="event-minimalist-title"> <h3 class="event-minimalist-title" :lang="event.language" dir="auto">
<b-tag <b-tag
class="mr-2" class="mr-2"
type="is-warning" type="is-warning"

View file

@ -51,7 +51,9 @@
params: { uuid: participation.event.uuid }, params: { uuid: participation.event.uuid },
}" }"
> >
<h3 class="title">{{ participation.event.title }}</h3> <h3 class="title" :lang="participation.event.language">
{{ participation.event.title }}
</h3>
</router-link> </router-link>
</div> </div>
<inline-address <inline-address

View file

@ -10,7 +10,9 @@
style="height: 120px" style="height: 120px"
/> />
<div class="title-info-wrapper has-text-grey-dark"> <div class="title-info-wrapper has-text-grey-dark">
<h3 class="post-minimalist-title">{{ post.title }}</h3> <h3 class="post-minimalist-title" :lang="post.language">
{{ post.title }}
</h3>
<p class="post-publication-date"> <p class="post-publication-date">
<b-icon icon="clock" /> <b-icon icon="clock" />
<span dir="auto" class="has-text-grey-dark" v-if="isBeforeLastWeek">{{ <span dir="auto" class="has-text-grey-dark" v-if="isBeforeLastWeek">{{

View file

@ -18,6 +18,7 @@ export const COMMENT_FIELDS_FRAGMENT = gql`
updatedAt updatedAt
deletedAt deletedAt
isAnnouncement isAnnouncement
language
} }
${ACTOR_FRAGMENT} ${ACTOR_FRAGMENT}
`; `;

View file

@ -22,6 +22,7 @@ const FULL_EVENT_FRAGMENT = gql`
visibility visibility
joinOptions joinOptions
draft draft
language
picture { picture {
id id
url url
@ -60,6 +61,7 @@ const FULL_EVENT_FRAGMENT = gql`
uuid uuid
title title
beginsOn beginsOn
language
picture { picture {
id id
url url
@ -153,6 +155,7 @@ export const FETCH_EVENTS = gql`
status status
visibility visibility
insertedAt insertedAt
language
picture { picture {
id id
url url

View file

@ -105,6 +105,7 @@ export const GROUP_FIELDS_FRAGMENTS = gql`
title title
beginsOn beginsOn
draft draft
language
options { options {
maximumAttendeeCapacity maximumAttendeeCapacity
} }

View file

@ -37,6 +37,7 @@ export const HOME_USER_QUERIES = gql`
} }
beginsOn beginsOn
visibility visibility
language
organizerActor { organizerActor {
...ActorFragment ...ActorFragment
} }
@ -79,6 +80,7 @@ export const HOME_USER_QUERIES = gql`
picture { picture {
url url
} }
language
attributedTo { attributedTo {
...ActorFragment ...ActorFragment
} }
@ -129,6 +131,7 @@ export const CLOSE_CONTENT = gql`
id id
url url
} }
language
tags { tags {
...TagFragment ...TagFragment
} }

View file

@ -21,6 +21,7 @@ export const POST_FRAGMENT = gql`
publishAt publishAt
draft draft
visibility visibility
language
tags { tags {
...TagFragment ...TagFragment
} }
@ -56,6 +57,7 @@ export const POST_BASIC_FIELDS = gql`
publishAt publishAt
draft draft
visibility visibility
language
picture { picture {
id id
url url

View file

@ -90,6 +90,7 @@ export interface IEvent {
options: IEventOptions; options: IEventOptions;
metadata: IEventMetadata[]; metadata: IEventMetadata[];
contacts: IActor[]; contacts: IActor[];
language: string;
toEditJSON(): IEventEditJSON; toEditJSON(): IEventEditJSON;
} }
@ -134,6 +135,8 @@ export class EventModel implements IEvent {
publishAt = new Date(); publishAt = new Date();
language = "und";
participantStats = { participantStats = {
notApproved: 0, notApproved: 0,
notConfirmed: 0, notConfirmed: 0,
@ -210,6 +213,7 @@ export class EventModel implements IEvent {
this.tags = hash.tags; this.tags = hash.tags;
this.metadata = hash.metadata; this.metadata = hash.metadata;
this.language = hash.language;
if (hash.options) this.options = hash.options; if (hash.options) this.options = hash.options;
} }

View file

@ -10,7 +10,12 @@
<section class="intro" dir="auto"> <section class="intro" dir="auto">
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<h1 class="title" style="margin: 0" dir="auto"> <h1
class="title"
style="margin: 0"
dir="auto"
:lang="event.language"
>
{{ event.title }} {{ event.title }}
</h1> </h1>
<div class="organizer"> <div class="organizer">
@ -289,6 +294,7 @@
</p> </p>
<div v-else> <div v-else>
<div <div
:lang="event.language"
dir="auto" dir="auto"
class="description-content" class="description-content"
ref="eventDescriptionElement" ref="eventDescriptionElement"

View file

@ -15,7 +15,7 @@
v-if="post.draft" v-if="post.draft"
>{{ $t("Draft") }}</b-tag >{{ $t("Draft") }}</b-tag
> >
<h1 class="title">{{ post.title }}</h1> <h1 class="title" :lang="post.language">{{ post.title }}</h1>
</div> </div>
<p class="metadata"> <p class="metadata">
<router-link <router-link
@ -165,7 +165,12 @@
}} }}
</b-message> </b-message>
<section v-html="post.body" dir="auto" class="content" /> <section
v-html="post.body"
dir="auto"
class="content"
:lang="post.language"
/>
<section class="tags" dir="auto"> <section class="tags" dir="auto">
<router-link <router-link
v-for="tag in post.tags" v-for="tag in post.tags"

View file

@ -23,6 +23,7 @@ const postData = {
body: "My content", body: "My content",
insertedAt: "2020-12-02T09:01:20.873Z", insertedAt: "2020-12-02T09:01:20.873Z",
tags: [], tags: [],
language: "en",
}; };
const generateWrapper = ( const generateWrapper = (

View file

@ -4,7 +4,9 @@ exports[`PostListItem renders post list item with basic informations 1`] = `
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper" dir="auto"> <a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper" dir="auto">
<!----> <!---->
<div class="title-info-wrapper has-text-grey-dark"> <div class="title-info-wrapper has-text-grey-dark">
<h3 class="post-minimalist-title">My Blog Post</h3> <h3 lang="en" class="post-minimalist-title">
My Blog Post
</h3>
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span dir="auto" class="has-text-grey-dark">Dec 2, 2020</span></p> <p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span dir="auto" class="has-text-grey-dark">Dec 2, 2020</span></p>
<!----> <!---->
<!----> <!---->
@ -16,7 +18,9 @@ exports[`PostListItem renders post list item with publisher name 1`] = `
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper" dir="auto"> <a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper" dir="auto">
<!----> <!---->
<div class="title-info-wrapper has-text-grey-dark"> <div class="title-info-wrapper has-text-grey-dark">
<h3 class="post-minimalist-title">My Blog Post</h3> <h3 lang="en" class="post-minimalist-title">
My Blog Post
</h3>
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span dir="auto" class="has-text-grey-dark">Dec 2, 2020</span></p> <p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span dir="auto" class="has-text-grey-dark">Dec 2, 2020</span></p>
<!----> <!---->
<p class="post-publisher has-text-grey-dark"><span class="icon"><i class="mdi mdi-account-edit mdi-24px"></i></span> <span>Published by <b class="has-text-weight-medium">An author</b></span></p> <p class="post-publisher has-text-grey-dark"><span class="icon"><i class="mdi mdi-account-edit mdi-24px"></i></span> <span>Published by <b class="has-text-weight-medium">An author</b></span></p>
@ -28,7 +32,9 @@ exports[`PostListItem renders post list item with tags 1`] = `
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper" dir="auto"> <a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper" dir="auto">
<!----> <!---->
<div class="title-info-wrapper has-text-grey-dark"> <div class="title-info-wrapper has-text-grey-dark">
<h3 class="post-minimalist-title">My Blog Post</h3> <h3 lang="en" class="post-minimalist-title">
My Blog Post
</h3>
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span dir="auto" class="has-text-grey-dark">Dec 2, 2020</span></p> <p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span dir="auto" class="has-text-grey-dark">Dec 2, 2020</span></p>
<div class="tags" style="display: inline;"><span class="icon"><i class="mdi mdi-tag mdi-24px"></i></span> <span class="tag"><!----><span class="">A tag</span> <div class="tags" style="display: inline;"><span class="icon"><i class="mdi mdi-tag mdi-24px"></i></span> <span class="tag"><!----><span class="">A tag</span>
<!----></span> <!----></span>

View file

@ -111,6 +111,7 @@ export const eventCommentThreadsMock = {
deletedAt: null, deletedAt: null,
insertedAt: "2020-12-03T09:02:00Z", insertedAt: "2020-12-03T09:02:00Z",
isAnnouncement: false, isAnnouncement: false,
language: "en",
}, },
{ {
__typename: "Comment", __typename: "Comment",
@ -141,6 +142,7 @@ export const eventCommentThreadsMock = {
deletedAt: null, deletedAt: null,
insertedAt: "2020-12-03T11:02:00Z", insertedAt: "2020-12-03T11:02:00Z",
isAnnouncement: false, isAnnouncement: false,
language: "en",
}, },
], ],
}, },
@ -185,6 +187,7 @@ export const newCommentForEventResponse: DataMock = {
deletedAt: null, deletedAt: null,
insertedAt: "2020-12-03T13:02:00Z", insertedAt: "2020-12-03T13:02:00Z",
isAnnouncement: false, isAnnouncement: false,
language: "en",
}, },
}, },
}; };