Skip to content

A platform for community discussion. Free, open, simple.

DEV: Add missing titles on sidebar buttons. (#16730)

Alan Guo Xiang Tan0bc04cb003ca
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/topics-section.js b/app/assets/javascripts/discourse/app/components/sidebar/topics-section.js
index 6d65e9d1ebb..e68fd2dafab 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/topics-section.js
+++ b/app/assets/javascripts/discourse/app/components/sidebar/topics-section.js
@@ -47,11 +47,11 @@ export default class SidebarTopicsSection extends GlimmerComponent {
get everythingSectionLinkBadgeText() {
if (this.totalUnread > 0) {
- return I18n.t("sidebar.sections.links.badge.unread_count", {
+ return I18n.t("sidebar.unread_count", {
count: this.totalUnread,
});
} else if (this.totalNew > 0) {
- return I18n.t("sidebar.sections.links.badge.new_count", {
+ return I18n.t("sidebar.new_count", {
count: this.totalNew,
});
} else {
diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs
index 19013d73494..70750f06eeb 100644
--- a/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs
@@ -5,9 +5,9 @@
@query={{@query}}
@models={{if @model (array @model) (if @models @models (array))}}
@current-when={{@current-when}}
- @title={{i18n (concat "sidebar.sections.links." @linkName ".title")}}
+ @title={{@title}}
>
- {{i18n (concat "sidebar.sections.links." @linkName ".content")}}
+ {{@content}}
{{#if @badgeText}}
<span class="sidebar-section-link-content-badge">
diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar/section.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar/section.hbs
index 91af8a1df51..3667ba75a0f 100644
--- a/app/assets/javascripts/discourse/app/templates/components/sidebar/section.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/sidebar/section.hbs
@@ -4,12 +4,12 @@
{{d-icon this.headerCaretIcon}}
</button>
- <LinkTo @route={{@headerRoute}} @query={{@headerQuery}} @class="sidebar-section-header-link">
- {{@headerTitle}}
+ <LinkTo @route={{@headerRoute}} @query={{@headerQuery}} @class="sidebar-section-header-link" title={{@headerLinkTitle}}>
+ {{@headerLinkText}}
</LinkTo>
{{#if @headerAction}}
- <button type="button" class="sidebar-section-header-button" {{on "click" @headerAction}}>
+ <button type="button" class="sidebar-section-header-button" {{on "click" @headerAction}} title={{@headerActionTitle}}>
{{d-icon @headerActionIcon}}
</button>
{{/if}}
diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar/topics-section.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar/topics-section.hbs
index 844df86443c..7d394723c53 100644
--- a/app/assets/javascripts/discourse/app/templates/components/sidebar/topics-section.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/sidebar/topics-section.hbs
@@ -2,17 +2,32 @@
@sectionName="topics"
@headerRoute="discovery.latest"
@headerQuery={{hash f=undefined}}
- @headerTitle="topics"
+ @headerLinkText={{i18n "sidebar.sections.topics.header_link_text"}}
+ @headerLinkTitle={{i18n "sidebar.sections.topics.header_link_title"}}
@headerActionIcon="plus"
- @headerAction={{this.composeTopic}}>
+ @headerAction={{this.composeTopic}}
+ @headerActionTitle={{i18n "sidebar.sections.topics.header_action_title"}}>
<Sidebar::SectionLink
@linkName="everything"
@route={{this.everythingSectionLinkRoute}}
@query={{hash f=undefined}}
+ @title={{i18n "sidebar.sections.topics.links.everything.title"}}
+ @content={{i18n "sidebar.sections.topics.links.everything.content"}}
@current-when={{"discovery.latest discovery.new discovery.unread discovery.top"}}
@badgeText={{this.everythingSectionLinkBadgeText}} />
- <Sidebar::SectionLink @linkName="tracked" @route="discovery.latest" @query={{hash f="tracked"}} />
- <Sidebar::SectionLink @linkName="bookmarked" @route="userActivity.bookmarks" @model={{this.currentUser}} />
+ <Sidebar::SectionLink
+ @linkName="tracked"
+ @route="discovery.latest"
+ @query={{hash f="tracked"}}
+ @title={{i18n "sidebar.sections.topics.links.tracked.title"}}
+ @content={{i18n "sidebar.sections.topics.links.tracked.content"}} />
+
+ <Sidebar::SectionLink
+ @linkName="bookmarked"
+ @route="userActivity.bookmarks"
+ @model={{this.currentUser}}
+ @title={{i18n "sidebar.sections.topics.links.bookmarked.title"}}
+ @content={{i18n "sidebar.sections.topics.links.bookmarked.content"}} />
</Sidebar::Section>
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index b9785d11b38..bfdca47c808 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -4032,20 +4032,23 @@ en:
redirect_after_success: "Second factor authentication is successful. Redirecting to the previous page…"
sidebar:
+ unread_count: "%{count} unread"
+ new_count: "%{count} new"
sections:
- links:
- badge:
- unread_count: "%{count} unread"
- new_count: "%{count} new"
- everything:
- content: "Everything"
- title: "All topics"
- tracked:
- content: "Tracked"
- title: "All tracked topics"
- bookmarked:
- content: "Bookmarked"
- title: "All bookmarked topics"
+ topics:
+ header_link_title: "home"
+ header_link_text: "Topics"
+ header_action_title: "create a new topic"
+ links:
+ everything:
+ content: "Everything"
+ title: "All topics"
+ tracked:
+ content: "Tracked"
+ title: "All tracked topics"
+ bookmarked:
+ content: "Bookmarked"
+ title: "All bookmarked topics"
# This section is exported to the javascript for i18n in the admin section
admin_js: