rendered_markdown: Convert spoiler message to FormatJS.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-04-12 20:48:41 -07:00 committed by Tim Abbott
parent 00fb1aaadc
commit 00db22ee76
2 changed files with 3 additions and 3 deletions

View File

@ -273,5 +273,5 @@ run_test("spoiler-header-empty-fill", () => {
'<span class="spoiler-button" aria-expanded="false"><span class="spoiler-arrow"></span></span>';
$header.html("");
rm.update_elements($content);
assert.equal(toggle_button_html + "<p>translated: Spoiler</p>", $header.html());
assert.equal(toggle_button_html + "<p>translated HTML: Spoiler</p>", $header.html());
});

View File

@ -7,7 +7,7 @@ import render_markdown_timestamp from "../templates/markdown_timestamp.hbs";
import view_code_in_playground from "../templates/view_code_in_playground.hbs";
import * as blueslip from "./blueslip";
import {i18n} from "./i18n";
import {$t_html, i18n} from "./i18n";
import {page_params} from "./page_params";
import * as people from "./people";
import * as rtl from "./rtl";
@ -187,7 +187,7 @@ export const update_elements = (content) => {
// If a spoiler block has no header content, it should have a default header.
// We do this client side to allow for i18n by the client.
if ($(this).html().trim().length === 0) {
$(this).append(`<p>${i18n.t("Spoiler")}</p>`);
$(this).append(`<p>${$t_html({defaultMessage: "Spoiler"})}</p>`);
}
// Add the expand/collapse button to spoiler blocks