Skip to content

Commit

Permalink
SAK-50672 webcomponents Make definition of _i18n more consistent (#13010
Browse files Browse the repository at this point in the history
)
  • Loading branch information
adrianfish authored Nov 10, 2024
1 parent 11c0edb commit a51a09f
Show file tree
Hide file tree
Showing 69 changed files with 431 additions and 772 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SakaiAnnouncements extends SakaiPageableElement {
super();

this.showPager = true;
this.loadTranslations("announcements").then(r => this.i18n = r);
this.loadTranslations("announcements").then(r => this._i18n = r);
}

set data(value) {
Expand Down Expand Up @@ -118,37 +118,37 @@ export class SakaiAnnouncements extends SakaiPageableElement {
</div>
` : nothing }
<div id="sorting">
<select aria-label="${this.i18n.announcement_sort_label}" @change=${this._sortChanged}>
<option value="${EARLIEST_FIRST}">${this.i18n.earliest_first}</option>
<option value="${LATEST_FIRST}">${this.i18n.latest_first}</option>
<option value="${TITLE_A_TO_Z}">${this.i18n.title_a_to_z}</option>
<option value="${TITLE_Z_TO_A}">${this.i18n.title_z_to_a}</option>
<option value="${SITE_A_TO_Z}">${this.i18n.site_a_to_z}</option>
<option value="${SITE_Z_TO_A}">${this.i18n.site_z_to_a}</option>
<select aria-label="${this._i18n.announcement_sort_label}" @change=${this._sortChanged}>
<option value="${EARLIEST_FIRST}">${this._i18n.earliest_first}</option>
<option value="${LATEST_FIRST}">${this._i18n.latest_first}</option>
<option value="${TITLE_A_TO_Z}">${this._i18n.title_a_to_z}</option>
<option value="${TITLE_Z_TO_A}">${this._i18n.title_z_to_a}</option>
<option value="${SITE_A_TO_Z}">${this._i18n.site_a_to_z}</option>
<option value="${SITE_Z_TO_A}">${this._i18n.site_z_to_a}</option>
</select>
</div>
</div>
<div id="viewing">${this.i18n.viewing}</div>
<div id="viewing">${this._i18n.viewing}</div>
<div class="announcements ${!this.siteId || this.siteId === "home" ? "home" : "course"}">
<div class="header">
<a href="javascript:;"
title="${this.i18n.sort_by_title_tooltip}"
aria-label="${this.i18n.sort_by_title_tooltip}"
title="${this._i18n.sort_by_title_tooltip}"
aria-label="${this._i18n.sort_by_title_tooltip}"
@click=${this.sortByTitle}>
${this.i18n.title}
${this._i18n.title}
</a>
</div>
${!this.siteId || this.siteId === "home" ? html`
<div class="header">
<a href="javascript:;"
title="${this.i18n.sort_by_site_tooltip}"
aria-label="${this.i18n.sort_by_site_tooltip}"
title="${this._i18n.sort_by_site_tooltip}"
aria-label="${this._i18n.sort_by_site_tooltip}"
@click=${this.sortBySite}>
${this.i18n.site}
${this._i18n.site}
</a>
</div>
` : nothing}
<div class="header">${this.i18n.view}</div>
<div class="header">${this._i18n.view}</div>
${this.dataPage.filter(a => a.visible).map((a, i) => html`
<div class="title cell ${i % 2 === 0 ? "even" : "odd"}">
${a.highlighted ? html`
Expand All @@ -161,8 +161,8 @@ export class SakaiAnnouncements extends SakaiPageableElement {
` : nothing}
<div class="url cell ${i % 2 === 0 ? "even" : "odd"}">
<a href="${a.url}"
title="${this.i18n.url_tooltip}"
aria-label="${this.i18n.url_tooltip}">
title="${this._i18n.url_tooltip}"
aria-label="${this._i18n.url_tooltip}">
<sakai-icon type="right" size="small"></sakai-icon>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { css, html, LitElement } from "lit";
import { SakaiShadowElement } from "@sakai-ui/sakai-element";
import { css, html } from "lit";

export class SakaiButton extends LitElement {
export class SakaiButton extends SakaiShadowElement {

static properties = {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export class SakaiCalendar extends LionCalendar {
userId: { attribute: "user-id", type: String },
siteId: { attribute: "site-id", type: String },
defer: { type: Boolean },
_i18n: { state: true },
_daysEvents: { state: true },
_events: { state: true },
};
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ConversationsStatistics extends SakaiElement {
this._sortByNameAscending = true;
this._count = 0;

this.loadTranslations("conversations").then(r => this.i18n = r);
this.loadTranslations("conversations").then(r => this._i18n = r);
}

set statsUrl(value) {
Expand Down Expand Up @@ -123,25 +123,25 @@ export class ConversationsStatistics extends SakaiElement {
_setAllTime() { this.interval = ALL_TIME; }

shouldUpdate() {
return this.i18n && this._stats;
return this._i18n && this._stats;
}

render() {

return html`
<div class="add-topic-wrapper">
<h1>${this.i18n.statistics}</h1>
<h1>${this._i18n.statistics}</h1>
<div id="statistics-timeframe-block">
<div>${this.i18n.timeframe}</div>
<div>${this._i18n.timeframe}</div>
<input type="radio"
name="timeframe"
value="${THIS_WEEK}"
@click="${this._setThisWeek}"
checked>${this.i18n.this_week}
checked>${this._i18n.this_week}
<input type="radio"
name="timeframe"
value="${ALL_TIME}"
@click="${this._setAllTime}">${this.i18n.all_time}
@click="${this._setAllTime}">${this._i18n.all_time}
</div>
</div>
<sakai-pager count="${this._count}" current="${this._currentPage}" @page-selected=${this._pageClicked}></sakai-pager>
Expand All @@ -151,11 +151,11 @@ export class ConversationsStatistics extends SakaiElement {
<th>
<a href="javascript:;"
data-sort="${SORT_NAME}"
title="${this.i18n.sort_by_author}"
aria-label="${this.i18n.sort_by_author}"
title="${this._i18n.sort_by_author}"
aria-label="${this._i18n.sort_by_author}"
@click=${this._toggleSort}>
<div class="header-sort-block">
<div>${this.i18n.name_header}</div>
<div>${this._i18n.name_header}</div>
<div>
<sakai-icon type="${this._sortByNameAscending ? "down" : "up"}" size="small"></sakai-icon>
</div>
Expand All @@ -165,11 +165,11 @@ export class ConversationsStatistics extends SakaiElement {
<th>
<a href="javascript:;"
data-sort="${SORT_TOPICS_CREATED}"
title="${this.i18n.sort_by_created_topics}"
aria-label="${this.i18n.sort_by_created_topics}"
title="${this._i18n.sort_by_created_topics}"
aria-label="${this._i18n.sort_by_created_topics}"
@click=${this._toggleSort}>
<div class="header-sort-block">
<div>${this.i18n.topics_created_header}</div>
<div>${this._i18n.topics_created_header}</div>
<div>
<sakai-icon type="${this._sortByTopicsCreatedAscending ? "down" : "up"}" size="small"></sakai-icon>
</div>
Expand All @@ -179,11 +179,11 @@ export class ConversationsStatistics extends SakaiElement {
<th>
<a href="javascript:;"
data-sort="${SORT_TOPICS_VIEWED}"
title="${this.i18n.sort_by_viewed_topics}"
aria-label="${this.i18n.sort_by_viewed_topics}"
title="${this._i18n.sort_by_viewed_topics}"
aria-label="${this._i18n.sort_by_viewed_topics}"
@click=${this._toggleSort}>
<div class="header-sort-block">
<div>${this.i18n.topics_read_header}</div>
<div>${this._i18n.topics_read_header}</div>
<div>
<sakai-icon type="${this._sortByTopicsViewedAscending ? "down" : "up"}" size="small"></sakai-icon>
</div>
Expand All @@ -193,11 +193,11 @@ export class ConversationsStatistics extends SakaiElement {
<th>
<a href="javascript:;"
data-sort="${SORT_REACTIONS_MADE}"
title="${this.i18n.sort_by_reactions_made}"
aria-label="${this.i18n.sort_by_reactions_made}"
title="${this._i18n.sort_by_reactions_made}"
aria-label="${this._i18n.sort_by_reactions_made}"
@click=${this._toggleSort}>
<div class="header-sort-block">
<div>${this.i18n.reactions_header}</div>
<div>${this._i18n.reactions_header}</div>
<div>
<sakai-icon type="${this._sortByReactionsMadeAscending ? "down" : "up"}" size="small"></sakai-icon>
</div>
Expand All @@ -207,11 +207,11 @@ export class ConversationsStatistics extends SakaiElement {
<th>
<a href="javascript:;"
data-sort="${SORT_POSTS_CREATED}"
title="${this.i18n.sort_by_created_posts}"
aria-label="${this.i18n.sort_by_created_posts}"
title="${this._i18n.sort_by_created_posts}"
aria-label="${this._i18n.sort_by_created_posts}"
@click=${this._toggleSort}>
<div class="header-sort-block">
<div>${this.i18n.posts_header}</div>
<div>${this._i18n.posts_header}</div>
<div>
<sakai-icon type="${this._sortByPostsCreatedAscending ? "down" : "up"}" size="small"></sakai-icon>
</div>
Expand Down
Loading

0 comments on commit a51a09f

Please sign in to comment.