Skip to content

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

DEV: Allow sidebar section caret title to be translated (#17491)

Alan Guo Xiang Tan737c0a7b9ff5
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 82baf9b3b67..73f28935176 100644
--- a/app/assets/javascripts/discourse/app/templates/components/sidebar/section.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/sidebar/section.hbs
@@ -1,6 +1,6 @@
<div class={{concat "sidebar-section-wrapper sidebar-section-" @sectionName}}>
<div class="sidebar-section-header">
- <button type="button" class="sidebar-section-header-caret" title="toggle section" {{on "click" this.toggleSectionDisplay}}>
+ <button type="button" class="sidebar-section-header-caret" title={{i18n "sidebar.toggle_section"}} {{on "click" this.toggleSectionDisplay}}>
{{d-icon this.headerCaretIcon}}
</button>
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-topics-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-topics-section-test.js
index c390a709dc2..7c0e8dc0243 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-topics-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-topics-section-test.js
@@ -1,3 +1,5 @@
+import I18n from "I18n";
+
import { test } from "qunit";
import { click, currentURL, settled, visit } from "@ember/test-helpers";
import {
@@ -64,6 +66,12 @@ acceptance("Sidebar - Topics Section", function (needs) {
"shows content section"
);
+ assert.strictEqual(
+ query(".sidebar-section-topics .sidebar-section-header-caret").title,
+ I18n.t("sidebar.toggle_section"),
+ "caret has the right title"
+ );
+
await click(".sidebar-section-topics .sidebar-section-header-caret");
assert.ok(
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index e5da978e931..1d53cb4cd23 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -4054,6 +4054,7 @@ en:
sidebar:
unread_count: "%{count} unread"
new_count: "%{count} new"
+ toggle_section: "toggle section"
sections:
messages:
header_link_title: "personal messages"