confirm_dialog: Convert heading, yes button messages to FormatJS.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-04-12 20:24:31 -07:00
committed by Tim Abbott
parent a397d51670
commit 00fb1aaadc
5 changed files with 20 additions and 14 deletions

View File

@@ -4,7 +4,7 @@ import render_confirm_delete_user_avatar from "../templates/confirm_delete_user_
import * as channel from "./channel"; import * as channel from "./channel";
import * as confirm_dialog from "./confirm_dialog"; import * as confirm_dialog from "./confirm_dialog";
import {i18n} from "./i18n"; import {$t_html} from "./i18n";
import {page_params} from "./page_params"; import {page_params} from "./page_params";
import * as settings_data from "./settings_data"; import * as settings_data from "./settings_data";
import * as upload_widget from "./upload_widget"; import * as upload_widget from "./upload_widget";
@@ -84,9 +84,9 @@ export function build_user_avatar_widget(upload_function) {
confirm_dialog.launch({ confirm_dialog.launch({
parent: modal_parent, parent: modal_parent,
html_heading: i18n.t("Delete profile picture"), html_heading: $t_html({defaultMessage: "Delete profile picture"}),
html_body, html_body,
html_yes_button: i18n.t("Confirm"), html_yes_button: $t_html({defaultMessage: "Confirm"}),
on_click: delete_user_avatar, on_click: delete_user_avatar,
}); });
}); });

View File

@@ -367,9 +367,9 @@ export function set_up() {
confirm_dialog.launch({ confirm_dialog.launch({
parent: modal_parent, parent: modal_parent,
html_heading: i18n.t("Delete user group"), html_heading: $t_html({defaultMessage: "Delete user group"}),
html_body, html_body,
html_yes_button: i18n.t("Confirm"), html_yes_button: $t_html({defaultMessage: "Confirm"}),
on_click: delete_user_group, on_click: delete_user_group,
}); });
}); });

View File

@@ -4,7 +4,7 @@ import render_confirm_unstar_all_messages from "../templates/confirm_unstar_all_
import render_confirm_unstar_all_messages_in_topic from "../templates/confirm_unstar_all_messages_in_topic.hbs"; import render_confirm_unstar_all_messages_in_topic from "../templates/confirm_unstar_all_messages_in_topic.hbs";
import * as confirm_dialog from "./confirm_dialog"; import * as confirm_dialog from "./confirm_dialog";
import {i18n} from "./i18n"; import {$t_html} from "./i18n";
import * as message_flags from "./message_flags"; import * as message_flags from "./message_flags";
export function confirm_unstar_all_messages() { export function confirm_unstar_all_messages() {
@@ -13,9 +13,9 @@ export function confirm_unstar_all_messages() {
confirm_dialog.launch({ confirm_dialog.launch({
parent: modal_parent, parent: modal_parent,
html_heading: i18n.t("Unstar all messages"), html_heading: $t_html({defaultMessage: "Unstar all messages"}),
html_body, html_body,
html_yes_button: i18n.t("Confirm"), html_yes_button: $t_html({defaultMessage: "Confirm"}),
on_click: message_flags.unstar_all_messages, on_click: message_flags.unstar_all_messages,
}); });
} }
@@ -32,9 +32,9 @@ export function confirm_unstar_all_messages_in_topic(stream_id, topic) {
confirm_dialog.launch({ confirm_dialog.launch({
parent: modal_parent, parent: modal_parent,
html_heading: i18n.t("Unstar messages in topic"), html_heading: $t_html({defaultMessage: "Unstar messages in topic"}),
html_body, html_body,
html_yes_button: i18n.t("Confirm"), html_yes_button: $t_html({defaultMessage: "Confirm"}),
on_click, on_click,
}); });
} }

View File

@@ -833,9 +833,12 @@ export function initialize() {
confirm_dialog.launch({ confirm_dialog.launch({
parent: modal_parent, parent: modal_parent,
html_heading: i18n.t("Unsubscribe from __stream_name__", {stream_name: sub.name}), html_heading: $t_html(
{defaultMessage: "Unsubscribe from {stream_name}"},
{stream_name: sub.name},
),
html_body, html_body,
html_yes_button: i18n.t("Yes, unsubscribe from this stream"), html_yes_button: $t_html({defaultMessage: "Yes, unsubscribe from this stream"}),
on_click: remove_user_from_private_stream, on_click: remove_user_from_private_stream,
}); });
return; return;

View File

@@ -954,9 +954,12 @@ export function unsubscribe_from_private_stream(sub, from_stream_popover) {
confirm_dialog.launch({ confirm_dialog.launch({
parent: modal_parent, parent: modal_parent,
html_heading: i18n.t("Unsubscribe from __stream_name__", {stream_name: sub.name}), html_heading: $t_html(
{defaultMessage: "Unsubscribe from {stream_name}"},
{stream_name: sub.name},
),
html_body, html_body,
html_yes_button: i18n.t("Yes, unsubscribe"), html_yes_button: $t_html({defaultMessage: "Yes, unsubscribe"}),
on_click: unsubscribe_from_stream, on_click: unsubscribe_from_stream,
}); });
} }