mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 03:19:10 +00:00
DEV: Add missing titles on sidebar buttons. (#16730)
* Also small refactor to reduce magical generation of translation string key when using `Section` and `SectionLink` components.
This commit is contained in:
parent
61eefcf037
commit
0bc04cb003
@ -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 {
|
||||
|
@ -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">
|
||||
|
@ -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}}
|
||||
|
@ -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>
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user