mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
i18n: Automatically convert remaining JavaScript messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
24646907dc
commit
2004a85fb1
@@ -3,7 +3,7 @@
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
@@ -135,7 +135,7 @@ run_test("remove_alert_word", (override) => {
|
||||
const remove_alert_word = $(".remove-alert-word");
|
||||
const list_item = $("tr.alert-word-item");
|
||||
const val_item = $("span.value");
|
||||
val_item.text(i18n.t("zot"));
|
||||
val_item.text($t({defaultMessage: "zot"}));
|
||||
|
||||
remove_alert_word.set_parents_result("tr", list_item);
|
||||
list_item.set_find_results(".value", val_item);
|
||||
|
||||
@@ -4,7 +4,7 @@ const {strict: assert} = require("assert");
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
@@ -181,9 +181,9 @@ run_test("basics", () => {
|
||||
widget = components.toggle({
|
||||
selected: 0,
|
||||
values: [
|
||||
{label: i18n.t("Keyboard shortcuts"), key: "keyboard-shortcuts"},
|
||||
{label: i18n.t("Message formatting"), key: "message-formatting"},
|
||||
{label: i18n.t("Search operators"), key: "search-operators"},
|
||||
{label: $t({defaultMessage: "Keyboard shortcuts"}), key: "keyboard-shortcuts"},
|
||||
{label: $t({defaultMessage: "Message formatting"}), key: "message-formatting"},
|
||||
{label: $t({defaultMessage: "Search operators"}), key: "search-operators"},
|
||||
],
|
||||
html_class: "stream_sorter_toggle",
|
||||
callback(name, key) {
|
||||
|
||||
@@ -6,7 +6,7 @@ const {JSDOM} = require("jsdom");
|
||||
const MockDate = require("mockdate");
|
||||
|
||||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {$t_html, i18n} = require("../zjsunit/i18n");
|
||||
const {$t, $t_html} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
@@ -1725,12 +1725,24 @@ test_ui("narrow_button_titles", () => {
|
||||
util.is_mobile = () => false;
|
||||
|
||||
compose.update_closed_compose_buttons_for_private();
|
||||
assert.equal($("#left_bar_compose_stream_button_big").text(), i18n.t("New stream message"));
|
||||
assert.equal($("#left_bar_compose_private_button_big").text(), i18n.t("New private message"));
|
||||
assert.equal(
|
||||
$("#left_bar_compose_stream_button_big").text(),
|
||||
$t({defaultMessage: "New stream message"}),
|
||||
);
|
||||
assert.equal(
|
||||
$("#left_bar_compose_private_button_big").text(),
|
||||
$t({defaultMessage: "New private message"}),
|
||||
);
|
||||
|
||||
compose.update_closed_compose_buttons_for_stream();
|
||||
assert.equal($("#left_bar_compose_stream_button_big").text(), i18n.t("New topic"));
|
||||
assert.equal($("#left_bar_compose_private_button_big").text(), i18n.t("New private message"));
|
||||
assert.equal(
|
||||
$("#left_bar_compose_stream_button_big").text(),
|
||||
$t({defaultMessage: "New topic"}),
|
||||
);
|
||||
assert.equal(
|
||||
$("#left_bar_compose_private_button_big").text(),
|
||||
$t({defaultMessage: "New private message"}),
|
||||
);
|
||||
});
|
||||
|
||||
MockDate.reset();
|
||||
|
||||
@@ -4,7 +4,7 @@ const {strict: assert} = require("assert");
|
||||
|
||||
const autosize = require("autosize");
|
||||
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
@@ -194,13 +194,19 @@ run_test("compute_placeholder_text", () => {
|
||||
};
|
||||
|
||||
// Stream narrows
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), i18n.t("Compose your message here"));
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Compose your message here"}),
|
||||
);
|
||||
|
||||
opts.stream = "all";
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), i18n.t("Message #all"));
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), $t({defaultMessage: "Message #all"}));
|
||||
|
||||
opts.topic = "Test";
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), i18n.t("Message #all > Test"));
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message #all > Test"}),
|
||||
);
|
||||
|
||||
// PM Narrows
|
||||
opts = {
|
||||
@@ -209,23 +215,32 @@ run_test("compute_placeholder_text", () => {
|
||||
topic: "",
|
||||
private_message_recipient: "",
|
||||
};
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), i18n.t("Compose your message here"));
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Compose your message here"}),
|
||||
);
|
||||
|
||||
opts.private_message_recipient = "bob@zulip.com";
|
||||
user_status.set_status_text({
|
||||
user_id: bob.user_id,
|
||||
status_text: "out to lunch",
|
||||
});
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), i18n.t("Message Bob (out to lunch)"));
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message Bob (out to lunch)"}),
|
||||
);
|
||||
|
||||
opts.private_message_recipient = "alice@zulip.com";
|
||||
user_status.set_status_text({
|
||||
user_id: alice.user_id,
|
||||
status_text: "",
|
||||
});
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), i18n.t("Message Alice"));
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), $t({defaultMessage: "Message Alice"}));
|
||||
|
||||
// Group PM
|
||||
opts.private_message_recipient = "alice@zulip.com,bob@zulip.com";
|
||||
assert.equal(compose_ui.compute_placeholder_text(opts), i18n.t("Message Alice, Bob"));
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message Alice, Bob"}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
@@ -33,7 +33,7 @@ run_test("basic_functions", () => {
|
||||
on_update: (val) => {
|
||||
updated_value = val;
|
||||
},
|
||||
default_text: i18n.t("not set"),
|
||||
default_text: $t({defaultMessage: "not set"}),
|
||||
render_text: (text) => `rendered: ${text}`,
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ run_test("no_default_value", () => {
|
||||
const opts = {
|
||||
widget_name: "my_setting",
|
||||
data: ["one", "two", "three"].map((x) => ({name: x, value: x})),
|
||||
default_text: i18n.t("not set"),
|
||||
default_text: $t({defaultMessage: "not set"}),
|
||||
render_text: (text) => `rendered: ${text}`,
|
||||
null_value: "null-value",
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ const {parseISO} = require("date-fns");
|
||||
const _ = require("lodash");
|
||||
const MockDate = require("mockdate");
|
||||
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
@@ -427,11 +427,11 @@ test_people("user_type", () => {
|
||||
people.add_active_user(guest);
|
||||
people.add_active_user(realm_owner);
|
||||
people.add_active_user(bot_botson);
|
||||
assert.equal(people.get_user_type(me.user_id), i18n.t("Member"));
|
||||
assert.equal(people.get_user_type(realm_admin.user_id), i18n.t("Administrator"));
|
||||
assert.equal(people.get_user_type(guest.user_id), i18n.t("Guest"));
|
||||
assert.equal(people.get_user_type(realm_owner.user_id), i18n.t("Owner"));
|
||||
assert.equal(people.get_user_type(bot_botson.user_id), i18n.t("Bot"));
|
||||
assert.equal(people.get_user_type(me.user_id), $t({defaultMessage: "Member"}));
|
||||
assert.equal(people.get_user_type(realm_admin.user_id), $t({defaultMessage: "Administrator"}));
|
||||
assert.equal(people.get_user_type(guest.user_id), $t({defaultMessage: "Guest"}));
|
||||
assert.equal(people.get_user_type(realm_owner.user_id), $t({defaultMessage: "Owner"}));
|
||||
assert.equal(people.get_user_type(bot_botson.user_id), $t({defaultMessage: "Bot"}));
|
||||
});
|
||||
|
||||
test_people("updates", () => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
@@ -162,7 +162,7 @@ test_ui("sender_hover", (override) => {
|
||||
user_email: "alice@example.com",
|
||||
user_id: 42,
|
||||
user_time: undefined,
|
||||
user_type: i18n.t("Member"),
|
||||
user_type: $t({defaultMessage: "Member"}),
|
||||
user_circle_class: "user_circle_empty",
|
||||
user_last_seen_time_status: "translated: More than 2 weeks ago",
|
||||
pm_with_uri: "#narrow/pm-with/42-alice",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
@@ -813,19 +813,19 @@ test("test get_organization_settings_options", () => {
|
||||
key: "by_admins_only",
|
||||
order: 1,
|
||||
code: 2,
|
||||
description: i18n.t("Admins"),
|
||||
description: $t({defaultMessage: "Admins"}),
|
||||
},
|
||||
{
|
||||
key: "by_full_members",
|
||||
order: 2,
|
||||
code: 3,
|
||||
description: i18n.t("Admins and full members"),
|
||||
description: $t({defaultMessage: "Admins and full members"}),
|
||||
},
|
||||
{
|
||||
key: "by_members",
|
||||
order: 3,
|
||||
code: 1,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
];
|
||||
assert.deepEqual(sorted_create_stream_policy_values, expected_create_stream_policy_values);
|
||||
@@ -836,17 +836,17 @@ test("test get_sorted_options_list", () => {
|
||||
by_admins_only: {
|
||||
order: 3,
|
||||
code: 2,
|
||||
description: i18n.t("Admins"),
|
||||
description: $t({defaultMessage: "Admins"}),
|
||||
},
|
||||
by_members: {
|
||||
order: 2,
|
||||
code: 1,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
by_full_members: {
|
||||
order: 1,
|
||||
code: 3,
|
||||
description: i18n.t("Admins and full members"),
|
||||
description: $t({defaultMessage: "Admins and full members"}),
|
||||
},
|
||||
};
|
||||
let expected_option_values = [
|
||||
@@ -854,19 +854,19 @@ test("test get_sorted_options_list", () => {
|
||||
key: "by_full_members",
|
||||
order: 1,
|
||||
code: 3,
|
||||
description: i18n.t("Admins and full members"),
|
||||
description: $t({defaultMessage: "Admins and full members"}),
|
||||
},
|
||||
{
|
||||
key: "by_members",
|
||||
order: 2,
|
||||
code: 1,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
{
|
||||
key: "by_admins_only",
|
||||
order: 3,
|
||||
code: 2,
|
||||
description: i18n.t("Admins"),
|
||||
description: $t({defaultMessage: "Admins"}),
|
||||
},
|
||||
];
|
||||
assert.deepEqual(settings_org.get_sorted_options_list(option_values_1), expected_option_values);
|
||||
@@ -874,32 +874,32 @@ test("test get_sorted_options_list", () => {
|
||||
const option_values_2 = {
|
||||
by_admins_only: {
|
||||
code: 1,
|
||||
description: i18n.t("Admins"),
|
||||
description: $t({defaultMessage: "Admins"}),
|
||||
},
|
||||
by_members: {
|
||||
code: 2,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
by_full_members: {
|
||||
code: 3,
|
||||
description: i18n.t("Admins and full members"),
|
||||
description: $t({defaultMessage: "Admins and full members"}),
|
||||
},
|
||||
};
|
||||
expected_option_values = [
|
||||
{
|
||||
key: "by_admins_only",
|
||||
code: 1,
|
||||
description: i18n.t("Admins"),
|
||||
description: $t({defaultMessage: "Admins"}),
|
||||
},
|
||||
{
|
||||
key: "by_full_members",
|
||||
code: 3,
|
||||
description: i18n.t("Admins and full members"),
|
||||
description: $t({defaultMessage: "Admins and full members"}),
|
||||
},
|
||||
{
|
||||
key: "by_members",
|
||||
code: 2,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
];
|
||||
assert.deepEqual(settings_org.get_sorted_options_list(option_values_2), expected_option_values);
|
||||
|
||||
@@ -5,7 +5,7 @@ const {strict: assert} = require("assert");
|
||||
const _ = require("lodash");
|
||||
|
||||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
@@ -575,7 +575,7 @@ test_ui("on_events", (override) => {
|
||||
assert.equal(opts.url, "/json/user_groups/1");
|
||||
assert.deepEqual(opts.data, data);
|
||||
|
||||
fake_this.text(i18n.t("fake-text"));
|
||||
fake_this.text($t({defaultMessage: "fake-text"}));
|
||||
opts.error();
|
||||
assert.equal(fake_this.text(), "translated: Failed!");
|
||||
};
|
||||
@@ -668,8 +668,8 @@ test_ui("on_events", (override) => {
|
||||
const handler_desc = $(user_group_selector).get_on_handler("input", ".description");
|
||||
const sib_des = $(description_selector);
|
||||
const sib_name = $(name_selector);
|
||||
sib_name.text(i18n.t("mobile"));
|
||||
sib_des.text(i18n.t("All mobile members"));
|
||||
sib_name.text($t({defaultMessage: "mobile"}));
|
||||
sib_des.text($t({defaultMessage: "All mobile members"}));
|
||||
|
||||
const group_data = {
|
||||
name: "translated: mobile",
|
||||
@@ -715,8 +715,8 @@ test_ui("on_events", (override) => {
|
||||
const handler_desc = $(user_group_selector).get_on_handler("blur", ".description");
|
||||
const sib_des = $(description_selector);
|
||||
const sib_name = $(name_selector);
|
||||
sib_name.text(i18n.t("mobile"));
|
||||
sib_des.text(i18n.t("All mobile members"));
|
||||
sib_name.text($t({defaultMessage: "mobile"}));
|
||||
sib_des.text($t({defaultMessage: "All mobile members"}));
|
||||
|
||||
const group_data = {members: new Set([2, 31])};
|
||||
user_groups.get_user_group_from_id = () => group_data;
|
||||
|
||||
@@ -5,7 +5,7 @@ const {strict: assert} = require("assert");
|
||||
const {add} = require("date-fns");
|
||||
const MockDate = require("mockdate");
|
||||
|
||||
const {i18n} = require("../zjsunit/i18n");
|
||||
const {$t} = require("../zjsunit/i18n");
|
||||
const {mock_cjs, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
@@ -20,7 +20,7 @@ const timerender = zrequire("timerender");
|
||||
run_test("render_now_returns_today", () => {
|
||||
const today = new Date(1555091573000); // Friday 4/12/2019 5:52:53 PM (UTC+0)
|
||||
const expected = {
|
||||
time_str: i18n.t("Today"),
|
||||
time_str: $t({defaultMessage: "Today"}),
|
||||
formal_time_str: "Friday, April 12, 2019",
|
||||
needs_update: true,
|
||||
};
|
||||
@@ -34,7 +34,7 @@ run_test("render_now_returns_yesterday", () => {
|
||||
const today = new Date(1555091573000); // Friday 4/12/2019 5:52:53 PM (UTC+0)
|
||||
const yesterday = add(today, {days: -1});
|
||||
const expected = {
|
||||
time_str: i18n.t("Yesterday"),
|
||||
time_str: $t({defaultMessage: "Yesterday"}),
|
||||
formal_time_str: "Thursday, April 11, 2019",
|
||||
needs_update: true,
|
||||
};
|
||||
@@ -91,7 +91,7 @@ run_test("render_date_renders_time_html", () => {
|
||||
|
||||
const today = new Date(1555091573000); // Friday 4/12/2019 5:52:53 PM (UTC+0)
|
||||
const message_time = today;
|
||||
const expected_html = i18n.t("Today");
|
||||
const expected_html = $t({defaultMessage: "Today"});
|
||||
|
||||
const attrs = {};
|
||||
const span_stub = $("<span />");
|
||||
@@ -127,10 +127,10 @@ run_test("render_date_renders_time_above_html", () => {
|
||||
|
||||
const expected = [
|
||||
'<i class="date-direction fa fa-caret-up"></i>',
|
||||
i18n.t("Yesterday"),
|
||||
$t({defaultMessage: "Yesterday"}),
|
||||
'<hr class="date-line">',
|
||||
'<i class="date-direction fa fa-caret-down"></i>',
|
||||
i18n.t("Today"),
|
||||
$t({defaultMessage: "Today"}),
|
||||
];
|
||||
|
||||
timerender.render_date(message_time, message_time_above, today);
|
||||
@@ -251,47 +251,47 @@ run_test("last_seen_status_from_date", () => {
|
||||
assert.equal(actual_status, expected_status);
|
||||
}
|
||||
|
||||
assert_same({seconds: -20}, i18n.t("Just now"));
|
||||
assert_same({seconds: -20}, $t({defaultMessage: "Just now"}));
|
||||
|
||||
assert_same({minutes: -1}, i18n.t("Just now"));
|
||||
assert_same({minutes: -1}, $t({defaultMessage: "Just now"}));
|
||||
|
||||
assert_same({minutes: -2}, i18n.t("Just now"));
|
||||
assert_same({minutes: -2}, $t({defaultMessage: "Just now"}));
|
||||
|
||||
assert_same({minutes: -30}, i18n.t("30 minutes ago"));
|
||||
assert_same({minutes: -30}, $t({defaultMessage: "30 minutes ago"}));
|
||||
|
||||
assert_same({hours: -1}, i18n.t("Yesterday"));
|
||||
assert_same({hours: -1}, $t({defaultMessage: "Yesterday"}));
|
||||
|
||||
assert_same({hours: -2}, i18n.t("Yesterday"));
|
||||
assert_same({hours: -2}, $t({defaultMessage: "Yesterday"}));
|
||||
|
||||
assert_same({hours: -20}, i18n.t("Yesterday"));
|
||||
assert_same({hours: -20}, $t({defaultMessage: "Yesterday"}));
|
||||
|
||||
assert_same({days: -1}, i18n.t("Yesterday"));
|
||||
assert_same({days: -1}, $t({defaultMessage: "Yesterday"}));
|
||||
|
||||
assert_same({days: -2}, i18n.t("2 days ago"));
|
||||
assert_same({days: -2}, $t({defaultMessage: "2 days ago"}));
|
||||
|
||||
assert_same({days: -61}, i18n.t("61 days ago"));
|
||||
assert_same({days: -61}, $t({defaultMessage: "61 days ago"}));
|
||||
|
||||
assert_same({days: -300}, i18n.t("May 06,\u00A02015"));
|
||||
assert_same({days: -300}, $t({defaultMessage: "May 06,\u00A02015"}));
|
||||
|
||||
assert_same({days: -366}, i18n.t("Mar 01,\u00A02015"));
|
||||
assert_same({days: -366}, $t({defaultMessage: "Mar 01,\u00A02015"}));
|
||||
|
||||
assert_same({years: -3}, i18n.t("Mar 01,\u00A02013"));
|
||||
assert_same({years: -3}, $t({defaultMessage: "Mar 01,\u00A02013"}));
|
||||
|
||||
// Set base_date to May 1 2016 12.30 AM (months are zero based)
|
||||
base_date = new Date(2016, 4, 1, 0, 30);
|
||||
|
||||
assert_same({days: -91}, i18n.t("Jan\u00A031"));
|
||||
assert_same({days: -91}, $t({defaultMessage: "Jan\u00A031"}));
|
||||
|
||||
// Set base_date to May 1 2016 10.30 PM (months are zero based)
|
||||
base_date = new Date(2016, 4, 2, 23, 30);
|
||||
|
||||
assert_same({hours: -1}, i18n.t("An hour ago"));
|
||||
assert_same({hours: -1}, $t({defaultMessage: "An hour ago"}));
|
||||
|
||||
assert_same({hours: -2}, i18n.t("2 hours ago"));
|
||||
assert_same({hours: -2}, $t({defaultMessage: "2 hours ago"}));
|
||||
|
||||
assert_same({hours: -12}, i18n.t("12 hours ago"));
|
||||
assert_same({hours: -12}, $t({defaultMessage: "12 hours ago"}));
|
||||
|
||||
assert_same({hours: -24}, i18n.t("Yesterday"));
|
||||
assert_same({hours: -24}, $t({defaultMessage: "Yesterday"}));
|
||||
});
|
||||
|
||||
run_test("set_full_datetime", () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import $ from "jquery";
|
||||
import render_admin_tab from "../templates/admin_tab.hbs";
|
||||
import render_settings_organization_settings_tip from "../templates/settings/organization_settings_tip.hbs";
|
||||
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as overlays from "./overlays";
|
||||
import {page_params} from "./page_params";
|
||||
import * as settings from "./settings";
|
||||
@@ -18,25 +18,31 @@ import * as settings_toggle from "./settings_toggle";
|
||||
|
||||
const admin_settings_label = {
|
||||
// Organization settings
|
||||
realm_allow_community_topic_editing: i18n.t("Users can edit the topic of any message"),
|
||||
realm_allow_edit_history: i18n.t("Enable message edit history"),
|
||||
realm_mandatory_topics: i18n.t("Require topics in stream messages"),
|
||||
realm_notifications_stream: i18n.t("New stream notifications:"),
|
||||
realm_signup_notifications_stream: i18n.t("New user notifications:"),
|
||||
realm_inline_image_preview: i18n.t("Show previews of uploaded and linked images"),
|
||||
realm_inline_url_embed_preview: i18n.t("Show previews of linked websites"),
|
||||
realm_default_twenty_four_hour_time: i18n.t("Time format"),
|
||||
realm_send_welcome_emails: i18n.t("Send emails introducing Zulip to new users"),
|
||||
realm_message_content_allowed_in_email_notifications: i18n.t(
|
||||
"Allow message content in missed message emails",
|
||||
),
|
||||
realm_digest_emails_enabled: i18n.t("Send weekly digest emails to inactive users"),
|
||||
realm_default_code_block_language: i18n.t("Default language for code blocks:"),
|
||||
realm_allow_community_topic_editing: $t({
|
||||
defaultMessage: "Users can edit the topic of any message",
|
||||
}),
|
||||
realm_allow_edit_history: $t({defaultMessage: "Enable message edit history"}),
|
||||
realm_mandatory_topics: $t({defaultMessage: "Require topics in stream messages"}),
|
||||
realm_notifications_stream: $t({defaultMessage: "New stream notifications:"}),
|
||||
realm_signup_notifications_stream: $t({defaultMessage: "New user notifications:"}),
|
||||
realm_inline_image_preview: $t({defaultMessage: "Show previews of uploaded and linked images"}),
|
||||
realm_inline_url_embed_preview: $t({defaultMessage: "Show previews of linked websites"}),
|
||||
realm_default_twenty_four_hour_time: $t({defaultMessage: "Time format"}),
|
||||
realm_send_welcome_emails: $t({defaultMessage: "Send emails introducing Zulip to new users"}),
|
||||
realm_message_content_allowed_in_email_notifications: $t({
|
||||
defaultMessage: "Allow message content in missed message emails",
|
||||
}),
|
||||
realm_digest_emails_enabled: $t({
|
||||
defaultMessage: "Send weekly digest emails to inactive users",
|
||||
}),
|
||||
realm_default_code_block_language: $t({defaultMessage: "Default language for code blocks:"}),
|
||||
|
||||
// Organization permissions
|
||||
realm_name_changes_disabled: i18n.t("Prevent users from changing their name"),
|
||||
realm_email_changes_disabled: i18n.t("Prevent users from changing their email address"),
|
||||
realm_avatar_changes_disabled: i18n.t("Prevent users from changing their avatar"),
|
||||
realm_name_changes_disabled: $t({defaultMessage: "Prevent users from changing their name"}),
|
||||
realm_email_changes_disabled: $t({
|
||||
defaultMessage: "Prevent users from changing their email address",
|
||||
}),
|
||||
realm_avatar_changes_disabled: $t({defaultMessage: "Prevent users from changing their avatar"}),
|
||||
};
|
||||
|
||||
function insert_tip_box() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import render_alert_word_settings_item from "../templates/settings/alert_word_se
|
||||
|
||||
import * as alert_words from "./alert_words";
|
||||
import * as channel from "./channel";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
|
||||
export function render_alert_words_ui() {
|
||||
const words = alert_words.get_word_list();
|
||||
@@ -38,10 +38,10 @@ function update_alert_word_status(status_text, is_error) {
|
||||
function add_alert_word(alert_word) {
|
||||
alert_word = alert_word.trim();
|
||||
if (alert_word === "") {
|
||||
update_alert_word_status(i18n.t("Alert word can't be empty!"), true);
|
||||
update_alert_word_status($t({defaultMessage: "Alert word can't be empty!"}), true);
|
||||
return;
|
||||
} else if (alert_words.has_alert_word(alert_word)) {
|
||||
update_alert_word_status(i18n.t("Alert word already exists!"), true);
|
||||
update_alert_word_status($t({defaultMessage: "Alert word already exists!"}), true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,14 +51,15 @@ function add_alert_word(alert_word) {
|
||||
url: "/json/users/me/alert_words",
|
||||
data: {alert_words: JSON.stringify(words_to_be_added)},
|
||||
success() {
|
||||
const message = i18n.t('Alert word "__word__" added successfully!', {
|
||||
word: words_to_be_added[0],
|
||||
});
|
||||
const message = $t(
|
||||
{defaultMessage: 'Alert word "{word}" added successfully!'},
|
||||
{word: words_to_be_added[0]},
|
||||
);
|
||||
update_alert_word_status(message, false);
|
||||
$("#create_alert_word_name").val("");
|
||||
},
|
||||
error() {
|
||||
update_alert_word_status(i18n.t("Error adding alert word!"), true);
|
||||
update_alert_word_status($t({defaultMessage: "Error adding alert word!"}), true);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -69,10 +70,13 @@ function remove_alert_word(alert_word) {
|
||||
url: "/json/users/me/alert_words",
|
||||
data: {alert_words: JSON.stringify(words_to_be_removed)},
|
||||
success() {
|
||||
update_alert_word_status(i18n.t("Alert word removed successfully!"), false);
|
||||
update_alert_word_status(
|
||||
$t({defaultMessage: "Alert word removed successfully!"}),
|
||||
false,
|
||||
);
|
||||
},
|
||||
error() {
|
||||
update_alert_word_status(i18n.t("Error removing alert word!"), true);
|
||||
update_alert_word_status($t({defaultMessage: "Error removing alert word!"}), true);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as compose_fade_users from "./compose_fade_users";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
import * as presence from "./presence";
|
||||
@@ -54,14 +54,14 @@ export function status_description(user_id) {
|
||||
|
||||
switch (status) {
|
||||
case "active":
|
||||
return i18n.t("Active");
|
||||
return $t({defaultMessage: "Active"});
|
||||
case "idle":
|
||||
return i18n.t("Idle");
|
||||
return $t({defaultMessage: "Idle"});
|
||||
case "away_them":
|
||||
case "away_me":
|
||||
return i18n.t("Unavailable");
|
||||
return $t({defaultMessage: "Unavailable"});
|
||||
default:
|
||||
return i18n.t("Offline");
|
||||
return $t({defaultMessage: "Offline"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,21 +154,21 @@ export function get_my_user_status(user_id) {
|
||||
}
|
||||
|
||||
if (user_status.is_away(user_id)) {
|
||||
return i18n.t("(unavailable)");
|
||||
return $t({defaultMessage: "(unavailable)"});
|
||||
}
|
||||
|
||||
return i18n.t("(you)");
|
||||
return $t({defaultMessage: "(you)"});
|
||||
}
|
||||
|
||||
export function user_last_seen_time_status(user_id) {
|
||||
const status = presence.get_status(user_id);
|
||||
if (status === "active") {
|
||||
return i18n.t("Active now");
|
||||
return $t({defaultMessage: "Active now"});
|
||||
}
|
||||
|
||||
if (page_params.realm_is_zephyr_mirror_realm) {
|
||||
// We don't send presence data to clients in Zephyr mirroring realms
|
||||
return i18n.t("Unknown");
|
||||
return $t({defaultMessage: "Unknown"});
|
||||
}
|
||||
|
||||
// There are situations where the client has incomplete presence
|
||||
@@ -179,7 +179,7 @@ export function user_last_seen_time_status(user_id) {
|
||||
// We give the somewhat vague status of "Unknown" for these users.
|
||||
const last_active_date = presence.last_active_date(user_id);
|
||||
if (last_active_date === undefined) {
|
||||
return i18n.t("More than 2 weeks ago");
|
||||
return $t({defaultMessage: "More than 2 weeks ago"});
|
||||
}
|
||||
return timerender.last_seen_status_from_date(last_active_date);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ function get_last_seen(active_status, last_seen) {
|
||||
return last_seen;
|
||||
}
|
||||
|
||||
const last_seen_text = i18n.t("Last active: __- last_seen__", {last_seen});
|
||||
const last_seen_text = $t({defaultMessage: "Last active: {last_seen}"}, {last_seen});
|
||||
return last_seen_text;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,10 @@ export function get_title_data(user_ids_string, is_group) {
|
||||
const bot_owner = people.get_bot_owner_user(person);
|
||||
|
||||
if (bot_owner) {
|
||||
const bot_owner_name = i18n.t("Owner: __name__", {name: bot_owner.full_name});
|
||||
const bot_owner_name = $t(
|
||||
{defaultMessage: "Owner: {name}"},
|
||||
{name: bot_owner.full_name},
|
||||
);
|
||||
|
||||
return {
|
||||
first_line: person.full_name,
|
||||
|
||||
@@ -19,7 +19,7 @@ import {media_breakpoints_num} from "./css_variables";
|
||||
import * as emoji_picker from "./emoji_picker";
|
||||
import * as hash_util from "./hash_util";
|
||||
import * as hotspots from "./hotspots";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_edit from "./message_edit";
|
||||
import * as message_edit_history from "./message_edit_history";
|
||||
import * as message_flags from "./message_flags";
|
||||
@@ -313,7 +313,7 @@ export function initialize() {
|
||||
$("body").on("click", ".copy_message", function (e) {
|
||||
const row = $(this).closest(".message_row");
|
||||
message_edit.end_message_row_edit(row);
|
||||
row.find(".alert-msg").text(i18n.t("Copied!"));
|
||||
row.find(".alert-msg").text($t({defaultMessage: "Copied!"}));
|
||||
row.find(".alert-msg").css("display", "block");
|
||||
row.find(".alert-msg").delay(1000).fadeOut(300);
|
||||
if ($(".tooltip").is(":visible")) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
|
||||
export const status_classes = "alert-error alert-success alert-info alert-warning";
|
||||
|
||||
@@ -59,11 +59,12 @@ export function password_warning(password, password_field) {
|
||||
const min_length = password_field.data("minLength");
|
||||
|
||||
if (password.length < min_length) {
|
||||
return i18n.t("Password should be at least __length__ characters long", {
|
||||
length: min_length,
|
||||
});
|
||||
return $t(
|
||||
{defaultMessage: "Password should be at least {length} characters long"},
|
||||
{length: min_length},
|
||||
);
|
||||
}
|
||||
return zxcvbn(password).feedback.warning || i18n.t("Password is too weak");
|
||||
return zxcvbn(password).feedback.warning || $t({defaultMessage: "Password is too weak"});
|
||||
}
|
||||
|
||||
export function phrase_match(query, phrase) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import * as compose_state from "./compose_state";
|
||||
import * as compose_ui from "./compose_ui";
|
||||
import * as drafts from "./drafts";
|
||||
import * as echo from "./echo";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as loading from "./loading";
|
||||
import * as markdown from "./markdown";
|
||||
import * as notifications from "./notifications";
|
||||
@@ -178,18 +178,18 @@ function update_conversation_button(btn_text, title) {
|
||||
}
|
||||
|
||||
export function update_closed_compose_buttons_for_private() {
|
||||
const text_stream = i18n.t("New stream message");
|
||||
const text_stream = $t({defaultMessage: "New stream message"});
|
||||
const title_stream = text_stream + " (c)";
|
||||
const text_conversation = i18n.t("New private message");
|
||||
const text_conversation = $t({defaultMessage: "New private message"});
|
||||
const title_conversation = text_conversation + " (x)";
|
||||
update_stream_button(text_stream, title_stream);
|
||||
update_conversation_button(text_conversation, title_conversation);
|
||||
}
|
||||
|
||||
export function update_closed_compose_buttons_for_stream() {
|
||||
const text_stream = i18n.t("New topic");
|
||||
const text_stream = $t({defaultMessage: "New topic"});
|
||||
const title_stream = text_stream + " (c)";
|
||||
const text_conversation = i18n.t("New private message");
|
||||
const text_conversation = $t({defaultMessage: "New private message"});
|
||||
const title_conversation = text_conversation + " (x)";
|
||||
update_stream_button(text_stream, title_stream);
|
||||
update_conversation_button(text_conversation, title_conversation);
|
||||
@@ -222,7 +222,7 @@ export function abort_video_callbacks(edit_message_id = "") {
|
||||
}
|
||||
|
||||
export function empty_topic_placeholder() {
|
||||
return i18n.t("(no topic)");
|
||||
return $t({defaultMessage: "(no topic)"});
|
||||
}
|
||||
|
||||
export function create_message_object() {
|
||||
@@ -801,9 +801,9 @@ export function validate() {
|
||||
$("#compose-send-button").prop("disabled", true).trigger("blur");
|
||||
const message_content = compose_state.message_content();
|
||||
if (reminder.is_deferred_delivery(message_content)) {
|
||||
show_sending_indicator(i18n.t("Scheduling..."));
|
||||
show_sending_indicator($t({defaultMessage: "Scheduling..."}));
|
||||
} else {
|
||||
show_sending_indicator(i18n.t("Sending..."));
|
||||
show_sending_indicator($t({defaultMessage: "Sending..."}));
|
||||
}
|
||||
|
||||
if (/^\s*$/.test(message_content)) {
|
||||
@@ -930,7 +930,7 @@ export function needs_subscribe_warning(user_id, stream_id) {
|
||||
}
|
||||
|
||||
function insert_video_call_url(url, target_textarea) {
|
||||
const link_text = i18n.t("Click to join video call");
|
||||
const link_text = $t({defaultMessage: "Click to join video call"});
|
||||
compose_ui.insert_syntax_and_focus(`[${link_text}](${url})`, target_textarea);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as compose_state from "./compose_state";
|
||||
import * as compose_ui from "./compose_ui";
|
||||
import * as drafts from "./drafts";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_lists from "./message_lists";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
@@ -459,10 +459,13 @@ export function quote_and_reply(opts) {
|
||||
// ```quote
|
||||
// message content
|
||||
// ```
|
||||
let content = i18n.t("__- username__ [said](__- link_to_message__):", {
|
||||
let content = $t(
|
||||
{defaultMessage: "{username} [said]({link_to_message}):"},
|
||||
{
|
||||
username: `@_**${message.sender_full_name}|${message.sender_id}**`,
|
||||
link_to_message: `${hash_util.by_conversation_and_time_uri(message)}`,
|
||||
});
|
||||
},
|
||||
);
|
||||
content += "\n";
|
||||
const fence = fenced_code.get_unused_fence(message.raw_content);
|
||||
content += `${fence}quote\n${message.raw_content}\n${fence}`;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import autosize from "autosize";
|
||||
import $ from "jquery";
|
||||
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as people from "./people";
|
||||
import * as user_status from "./user_status";
|
||||
|
||||
@@ -88,12 +88,12 @@ export function compute_placeholder_text(opts) {
|
||||
// placeholder field in a way that does HTML escaping.
|
||||
if (opts.message_type === "stream") {
|
||||
if (opts.topic) {
|
||||
return i18n.t("Message #__- stream_name__ > __- topic_name__", {
|
||||
stream_name: opts.stream,
|
||||
topic_name: opts.topic,
|
||||
});
|
||||
return $t(
|
||||
{defaultMessage: "Message #{stream_name} > {topic_name}"},
|
||||
{stream_name: opts.stream, topic_name: opts.topic},
|
||||
);
|
||||
} else if (opts.stream) {
|
||||
return i18n.t("Message #__- stream_name__", {stream_name: opts.stream});
|
||||
return $t({defaultMessage: "Message #{stream_name}"}, {stream_name: opts.stream});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,13 +112,13 @@ export function compute_placeholder_text(opts) {
|
||||
const user = people.get_by_email(recipient_list[0]);
|
||||
const status = user_status.get_status_text(user.user_id);
|
||||
if (status) {
|
||||
return i18n.t("Message __- recipient_name__ (__- recipient_status__)", {
|
||||
recipient_name: recipient_names,
|
||||
recipient_status: status,
|
||||
});
|
||||
return $t(
|
||||
{defaultMessage: "Message {recipient_name} ({recipient_status})"},
|
||||
{recipient_name: recipient_names, recipient_status: status},
|
||||
);
|
||||
}
|
||||
}
|
||||
return i18n.t("Message __- recipient_names__", {recipient_names});
|
||||
return $t({defaultMessage: "Message {recipient_names}"}, {recipient_names});
|
||||
}
|
||||
return i18n.t("Compose your message here");
|
||||
return $t({defaultMessage: "Compose your message here"});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as compose from "./compose";
|
||||
import * as compose_pm_pill from "./compose_pm_pill";
|
||||
import * as compose_state from "./compose_state";
|
||||
import * as compose_ui from "./compose_ui";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_store from "./message_store";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
@@ -326,9 +326,10 @@ export function tokenize_compose_str(s) {
|
||||
|
||||
export function broadcast_mentions() {
|
||||
return ["all", "everyone", "stream"].map((mention, idx) => ({
|
||||
special_item_text: i18n.t("__wildcard_mention_token__ (Notify stream)", {
|
||||
wildcard_mention_token: mention,
|
||||
}),
|
||||
special_item_text: $t(
|
||||
{defaultMessage: "{wildcard_mention_token} (Notify stream)"},
|
||||
{wildcard_mention_token: mention},
|
||||
),
|
||||
|
||||
email: mention,
|
||||
|
||||
@@ -373,43 +374,43 @@ function should_show_custom_query(query, items) {
|
||||
|
||||
export const slash_commands = [
|
||||
{
|
||||
text: i18n.t("/dark (Toggle night mode)"),
|
||||
text: $t({defaultMessage: "/dark (Toggle night mode)"}),
|
||||
name: "dark",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/day (Toggle day mode)"),
|
||||
text: $t({defaultMessage: "/day (Toggle day mode)"}),
|
||||
name: "day",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/fixed-width (Toggle fixed width mode)"),
|
||||
text: $t({defaultMessage: "/fixed-width (Toggle fixed width mode)"}),
|
||||
name: "fixed-width",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/fluid-width (Toggle fluid width mode)"),
|
||||
text: $t({defaultMessage: "/fluid-width (Toggle fluid width mode)"}),
|
||||
name: "fluid-width",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/light (Toggle day mode)"),
|
||||
text: $t({defaultMessage: "/light (Toggle day mode)"}),
|
||||
name: "light",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/me is excited (Display action text)"),
|
||||
text: $t({defaultMessage: "/me is excited (Display action text)"}),
|
||||
name: "me",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/night (Toggle night mode)"),
|
||||
text: $t({defaultMessage: "/night (Toggle night mode)"}),
|
||||
name: "night",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/poll Where should we go to lunch today? (Create a poll)"),
|
||||
text: $t({defaultMessage: "/poll Where should we go to lunch today? (Create a poll)"}),
|
||||
name: "poll",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/settings (Load settings menu)"),
|
||||
text: $t({defaultMessage: "/settings (Load settings menu)"}),
|
||||
name: "settings",
|
||||
},
|
||||
{
|
||||
text: i18n.t("/todo (Create a todo list)"),
|
||||
text: $t({defaultMessage: "/todo (Create a todo list)"}),
|
||||
name: "todo",
|
||||
},
|
||||
];
|
||||
@@ -723,7 +724,7 @@ export function get_candidates(query) {
|
||||
const time_jump_regex = /<time(:([^>]*?)>?)?$/;
|
||||
if (time_jump_regex.test(split[0])) {
|
||||
this.completing = "time_jump";
|
||||
return [i18n.t("Mention a timezone-aware time")];
|
||||
return [$t({defaultMessage: "Mention a timezone-aware time"})];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -993,16 +994,17 @@ function get_header_html() {
|
||||
let tip_text = "";
|
||||
switch (this.completing) {
|
||||
case "stream":
|
||||
tip_text = i18n.t("Press > for list of topics");
|
||||
tip_text = $t({defaultMessage: "Press > for list of topics"});
|
||||
break;
|
||||
case "silent_mention":
|
||||
tip_text = i18n.t("User will not be notified");
|
||||
tip_text = $t({defaultMessage: "User will not be notified"});
|
||||
break;
|
||||
case "syntax":
|
||||
if (page_params.realm_default_code_block_language !== null) {
|
||||
tip_text = i18n.t("Default is __language__. Use 'text' to disable highlighting.", {
|
||||
language: page_params.realm_default_code_block_language,
|
||||
});
|
||||
tip_text = $t(
|
||||
{defaultMessage: "Default is {language}. Use 'text' to disable highlighting."},
|
||||
{language: page_params.realm_default_code_block_language},
|
||||
);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as compose_actions from "./compose_actions";
|
||||
import * as compose_fade from "./compose_fade";
|
||||
import * as compose_state from "./compose_state";
|
||||
import * as compose_ui from "./compose_ui";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import {localstorage} from "./localstorage";
|
||||
import * as markdown from "./markdown";
|
||||
import * as narrow from "./narrow";
|
||||
@@ -24,7 +24,7 @@ import * as util from "./util";
|
||||
|
||||
function set_count(count) {
|
||||
const draft_count = count.toString();
|
||||
const text = i18n.t("Drafts (__draft_count__)", {draft_count});
|
||||
const text = $t({defaultMessage: "Drafts ({draft_count})"}, {draft_count});
|
||||
$(".compose_drafts_button").text(text);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ export function format_draft(draft) {
|
||||
let formatted;
|
||||
const time = new Date(draft.updatedAt);
|
||||
let time_stamp = timerender.render_now(time).time_str;
|
||||
if (time_stamp === i18n.t("Today")) {
|
||||
if (time_stamp === $t({defaultMessage: "Today"})) {
|
||||
time_stamp = timerender.stringify_time(time);
|
||||
}
|
||||
if (draft.type === "stream") {
|
||||
|
||||
@@ -10,7 +10,7 @@ import render_emoji_showcase from "../templates/emoji_showcase.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as compose_ui from "./compose_ui";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_lists from "./message_lists";
|
||||
import * as message_store from "./message_store";
|
||||
import * as popovers from "./popovers";
|
||||
@@ -631,7 +631,7 @@ export function build_emoji_popover(elt, id) {
|
||||
trigger: "manual",
|
||||
});
|
||||
elt.popover("show");
|
||||
elt.prop("title", i18n.t("Add emoji reaction (:)"));
|
||||
elt.prop("title", $t({defaultMessage: "Add emoji reaction (:)"}));
|
||||
|
||||
const popover = elt.data("popover").$tip;
|
||||
popover.find(".emoji-popover-filter").trigger("focus");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Handlebars from "handlebars/runtime";
|
||||
import _ from "lodash";
|
||||
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_parser from "./message_parser";
|
||||
import * as message_store from "./message_store";
|
||||
import {page_params} from "./page_params";
|
||||
@@ -592,29 +592,29 @@ export class Filter {
|
||||
(term_types.length === 2 && _.isEqual(term_types, ["stream", "topic"]))
|
||||
) {
|
||||
if (!this._sub) {
|
||||
return i18n.t("Unknown stream");
|
||||
return $t({defaultMessage: "Unknown stream"});
|
||||
}
|
||||
return this._sub.name;
|
||||
}
|
||||
if (term_types.length === 1 || (term_types.length === 2 && term_types[1] === "search")) {
|
||||
switch (term_types[0]) {
|
||||
case "in-home":
|
||||
return i18n.t("All messages");
|
||||
return $t({defaultMessage: "All messages"});
|
||||
case "in-all":
|
||||
return i18n.t("All messages including muted streams");
|
||||
return $t({defaultMessage: "All messages including muted streams"});
|
||||
case "streams-public":
|
||||
return i18n.t("Public stream messages in organization");
|
||||
return $t({defaultMessage: "Public stream messages in organization"});
|
||||
case "stream":
|
||||
if (!this._sub) {
|
||||
return i18n.t("Unknown stream");
|
||||
return $t({defaultMessage: "Unknown stream"});
|
||||
}
|
||||
return this._sub.name;
|
||||
case "is-starred":
|
||||
return i18n.t("Starred messages");
|
||||
return $t({defaultMessage: "Starred messages"});
|
||||
case "is-mentioned":
|
||||
return i18n.t("Mentions");
|
||||
return $t({defaultMessage: "Mentions"});
|
||||
case "is-private":
|
||||
return i18n.t("Private messages");
|
||||
return $t({defaultMessage: "Private messages"});
|
||||
case "pm-with": {
|
||||
const emails = this.operands("pm-with")[0].split(",");
|
||||
const names = emails.map((email) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import * as hashchange from "./hashchange";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as navigate from "./navigate";
|
||||
import {page_params} from "./page_params";
|
||||
@@ -85,9 +85,9 @@ const scroll_positions = new Map();
|
||||
export function update_org_settings_menu_item() {
|
||||
const item = $(".admin-menu-item").expectOne();
|
||||
if (page_params.is_admin) {
|
||||
item.find("span").text(i18n.t("Manage organization"));
|
||||
item.find("span").text($t({defaultMessage: "Manage organization"}));
|
||||
} else {
|
||||
item.find("span").text(i18n.t("Organization settings"));
|
||||
item.find("span").text($t({defaultMessage: "Organization settings"}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import render_markdown_help from "../templates/markdown_help.hbs";
|
||||
import * as browser_history from "./browser_history";
|
||||
import * as common from "./common";
|
||||
import * as components from "./components";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as keydown_util from "./keydown_util";
|
||||
import * as markdown from "./markdown";
|
||||
import * as overlays from "./overlays";
|
||||
@@ -169,9 +169,9 @@ export function set_up_toggler() {
|
||||
selected: 0,
|
||||
child_wants_focus: true,
|
||||
values: [
|
||||
{label: i18n.t("Keyboard shortcuts"), key: "keyboard-shortcuts"},
|
||||
{label: i18n.t("Message formatting"), key: "message-formatting"},
|
||||
{label: i18n.t("Search operators"), key: "search-operators"},
|
||||
{label: $t({defaultMessage: "Keyboard shortcuts"}), key: "keyboard-shortcuts"},
|
||||
{label: $t({defaultMessage: "Message formatting"}), key: "message-formatting"},
|
||||
{label: $t({defaultMessage: "Search operators"}), key: "search-operators"},
|
||||
],
|
||||
callback(name, key) {
|
||||
$(".overlay-modal").hide();
|
||||
|
||||
@@ -10,7 +10,7 @@ import render_settings_dev_env_email_access from "../templates/settings/dev_env_
|
||||
import * as browser_history from "./browser_history";
|
||||
import * as channel from "./channel";
|
||||
import * as common from "./common";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as overlays from "./overlays";
|
||||
import {page_params} from "./page_params";
|
||||
import * as stream_data from "./stream_data";
|
||||
@@ -114,7 +114,7 @@ function submit_invitation_form() {
|
||||
}
|
||||
},
|
||||
complete() {
|
||||
$("#submit-invitation").text(i18n.t("Invite"));
|
||||
$("#submit-invitation").text($t({defaultMessage: "Invite"}));
|
||||
$("#submit-invitation").prop("disabled", false);
|
||||
$("#invitee_emails").focus();
|
||||
ui.get_scroll_element($("#invite_user_form .modal-body"))[0].scrollTop = 0;
|
||||
@@ -138,7 +138,7 @@ function generate_multiuse_invite() {
|
||||
ui_report.error("", xhr, invite_status);
|
||||
},
|
||||
complete() {
|
||||
$("#submit-invitation").text(i18n.t("Generate invite link"));
|
||||
$("#submit-invitation").text($t({defaultMessage: "Generate invite link"}));
|
||||
$("#submit-invitation").prop("disabled", false);
|
||||
},
|
||||
});
|
||||
@@ -213,15 +213,15 @@ export function initialize() {
|
||||
$("#multiuse_radio_section").show();
|
||||
$("#invite-method-choice").hide();
|
||||
$("#invitee_emails").prop("disabled", true);
|
||||
$("#submit-invitation").text(i18n.t("Generate invite link"));
|
||||
$("#submit-invitation").data("loading-text", i18n.t("Generating link..."));
|
||||
$("#submit-invitation").text($t({defaultMessage: "Generate invite link"}));
|
||||
$("#submit-invitation").data("loading-text", $t({defaultMessage: "Generating link..."}));
|
||||
reset_error_messages();
|
||||
});
|
||||
|
||||
$("#invite-user").on("change", "#generate_multiuse_invite_radio", () => {
|
||||
$("#invitee_emails").prop("disabled", false);
|
||||
$("#submit-invitation").text(i18n.t("Invite"));
|
||||
$("#submit-invitation").data("loading-text", i18n.t("Inviting..."));
|
||||
$("#submit-invitation").text($t({defaultMessage: "Invite"}));
|
||||
$("#submit-invitation").data("loading-text", $t({defaultMessage: "Inviting..."}));
|
||||
$("#multiuse_radio_section").hide();
|
||||
$("#invite-method-choice").show();
|
||||
reset_error_messages();
|
||||
|
||||
@@ -11,7 +11,7 @@ import * as compose_actions from "./compose_actions";
|
||||
import * as composebox_typeahead from "./composebox_typeahead";
|
||||
import * as condense from "./condense";
|
||||
import * as echo from "./echo";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as loading from "./loading";
|
||||
import * as markdown from "./markdown";
|
||||
import * as message_lists from "./message_lists";
|
||||
@@ -288,11 +288,14 @@ function timer_text(seconds_left) {
|
||||
const minutes = Math.floor(seconds_left / 60);
|
||||
const seconds = seconds_left % 60;
|
||||
if (minutes >= 1) {
|
||||
return i18n.t("__minutes__ min to edit", {minutes: minutes.toString()});
|
||||
return $t({defaultMessage: "{minutes} min to edit"}, {minutes: minutes.toString()});
|
||||
} else if (seconds_left >= 10) {
|
||||
return i18n.t("__seconds__ sec to edit", {seconds: (seconds - (seconds % 5)).toString()});
|
||||
return $t(
|
||||
{defaultMessage: "{seconds} sec to edit"},
|
||||
{seconds: (seconds - (seconds % 5)).toString()},
|
||||
);
|
||||
}
|
||||
return i18n.t("__seconds__ sec to edit", {seconds: seconds.toString()});
|
||||
return $t({defaultMessage: "{seconds} sec to edit"}, {seconds: seconds.toString()});
|
||||
}
|
||||
|
||||
function create_copy_to_clipboard_handler(source, message_id) {
|
||||
@@ -391,12 +394,12 @@ function edit_message(row, raw_content) {
|
||||
// in streams), then we'll need to disable
|
||||
// row.find('input.message_edit_topic') as well.
|
||||
message_edit_content.attr("readonly", "readonly");
|
||||
message_edit_countdown_timer.text(i18n.t("View source"));
|
||||
message_edit_countdown_timer.text($t({defaultMessage: "View source"}));
|
||||
create_copy_to_clipboard_handler(copy_message[0], message.id);
|
||||
} else if (editability === editability_types.TOPIC_ONLY) {
|
||||
message_edit_content.attr("readonly", "readonly");
|
||||
// Hint why you can edit the topic but not the message content
|
||||
message_edit_countdown_timer.text(i18n.t("Topic editing only"));
|
||||
message_edit_countdown_timer.text($t({defaultMessage: "Topic editing only"}));
|
||||
create_copy_to_clipboard_handler(copy_message[0], message.id);
|
||||
} else if (editability === editability_types.FULL) {
|
||||
copy_message.remove();
|
||||
@@ -459,7 +462,7 @@ function edit_message(row, raw_content) {
|
||||
// the half-finished edit around so that they can copy-paste it, but we don't want
|
||||
// people to think "Save" will save the half-finished edit.
|
||||
message_edit_save.addClass("disabled");
|
||||
message_edit_countdown_timer.text(i18n.t("Time's up!"));
|
||||
message_edit_countdown_timer.text($t({defaultMessage: "Time's up!"}));
|
||||
} else {
|
||||
message_edit_countdown_timer.text(timer_text(seconds_left));
|
||||
}
|
||||
@@ -656,7 +659,10 @@ export function save_inline_topic_edit(row) {
|
||||
loading.destroy_indicator(spinner);
|
||||
if (msg_list === message_lists.current) {
|
||||
message_id = rows.id_for_recipient_row(row);
|
||||
const message = channel.xhr_error_message(i18n.t("Error saving edit"), xhr);
|
||||
const message = channel.xhr_error_message(
|
||||
$t({defaultMessage: "Error saving edit"}),
|
||||
xhr,
|
||||
);
|
||||
row.find(".edit_error").text(message).css("display", "inline-block");
|
||||
}
|
||||
},
|
||||
@@ -819,7 +825,10 @@ export function save_message_row_edit(row) {
|
||||
}
|
||||
|
||||
hide_message_edit_spinner(row);
|
||||
const message = channel.xhr_error_message(i18n.t("Error saving edit"), xhr);
|
||||
const message = channel.xhr_error_message(
|
||||
$t({defaultMessage: "Error saving edit"}),
|
||||
xhr,
|
||||
);
|
||||
row.find(".edit_error").text(message).show();
|
||||
}
|
||||
},
|
||||
@@ -957,7 +966,7 @@ export function move_topic_containing_message_to_stream(
|
||||
if (currently_topic_editing_messages.includes(message_id)) {
|
||||
hide_topic_move_spinner();
|
||||
$("#topic_stream_edit_form_error .error-msg").text(
|
||||
i18n.t("A Topic Move already in progress."),
|
||||
$t({defaultMessage: "A Topic Move already in progress."}),
|
||||
);
|
||||
$("#topic_stream_edit_form_error").show();
|
||||
return;
|
||||
|
||||
@@ -14,7 +14,7 @@ import * as compose from "./compose";
|
||||
import * as compose_fade from "./compose_fade";
|
||||
import * as condense from "./condense";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_edit from "./message_edit";
|
||||
import * as message_lists from "./message_lists";
|
||||
import * as message_store from "./message_store";
|
||||
@@ -615,9 +615,9 @@ export class MessageListView {
|
||||
// for rendering.
|
||||
const message_containers = messages.map((message) => {
|
||||
if (message.starred) {
|
||||
message.starred_status = i18n.t("Unstar");
|
||||
message.starred_status = $t({defaultMessage: "Unstar"});
|
||||
} else {
|
||||
message.starred_status = i18n.t("Star");
|
||||
message.starred_status = $t({defaultMessage: "Star"});
|
||||
}
|
||||
|
||||
return {msg: message};
|
||||
|
||||
@@ -2,7 +2,7 @@ import $ from "jquery";
|
||||
|
||||
import render_message_view_header from "../templates/message_view_header.hbs";
|
||||
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import {page_params} from "./page_params";
|
||||
import * as peer_data from "./peer_data";
|
||||
@@ -22,13 +22,13 @@ function make_message_view_header(filter) {
|
||||
const message_view_header = {};
|
||||
if (recent_topics.is_visible()) {
|
||||
return {
|
||||
title: i18n.t("Recent topics"),
|
||||
title: $t({defaultMessage: "Recent topics"}),
|
||||
icon: "clock-o",
|
||||
};
|
||||
}
|
||||
if (filter === undefined) {
|
||||
return {
|
||||
title: i18n.t("All messages"),
|
||||
title: $t({defaultMessage: "All messages"}),
|
||||
icon: "align-left",
|
||||
};
|
||||
}
|
||||
@@ -37,9 +37,9 @@ function make_message_view_header(filter) {
|
||||
if (filter.has_operator("stream") && !filter._sub) {
|
||||
message_view_header.sub_count = "0";
|
||||
message_view_header.formatted_sub_count = "0";
|
||||
message_view_header.rendered_narrow_description = i18n.t(
|
||||
"This stream does not exist or is private.",
|
||||
);
|
||||
message_view_header.rendered_narrow_description = $t({
|
||||
defaultMessage: "This stream does not exist or is private.",
|
||||
});
|
||||
return message_view_header;
|
||||
}
|
||||
if (filter._sub) {
|
||||
@@ -52,8 +52,8 @@ function make_message_view_header(filter) {
|
||||
message_view_header.sub_count = sub_count;
|
||||
message_view_header.formatted_sub_count = get_formatted_sub_count(sub_count);
|
||||
// the "title" is passed as a variable and doesn't get translated (nor should it)
|
||||
message_view_header.sub_count_tooltip_text = i18n.t(
|
||||
"__count__ users are subscribed to #__title__",
|
||||
message_view_header.sub_count_tooltip_text = $t(
|
||||
{defaultMessage: "{count} users are subscribed to #{title}"},
|
||||
{count: message_view_header.sub_count, title: message_view_header.title},
|
||||
);
|
||||
message_view_header.stream_settings_link =
|
||||
|
||||
@@ -5,7 +5,7 @@ import render_topic_muted from "../templates/topic_muted.hbs";
|
||||
|
||||
import * as channel from "./channel";
|
||||
import * as feedback_widget from "./feedback_widget";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as ListWidget from "./list_widget";
|
||||
import * as message_lists from "./message_lists";
|
||||
import * as muting from "./muting";
|
||||
@@ -128,8 +128,8 @@ export function mute_topic(stream_id, topic) {
|
||||
on_undo() {
|
||||
unmute_topic(stream_id, topic);
|
||||
},
|
||||
title_text: i18n.t("Topic muted"),
|
||||
undo_button_text: i18n.t("Unmute"),
|
||||
title_text: $t({defaultMessage: "Topic muted"}),
|
||||
undo_button_text: $t({defaultMessage: "Unmute"}),
|
||||
});
|
||||
recent_topics.update_topic_is_muted(stream_id, topic);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import $ from "jquery";
|
||||
import _ from "lodash";
|
||||
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
@@ -22,7 +22,7 @@ function show_search_query() {
|
||||
let query_contains_stop_words = false;
|
||||
|
||||
// Also removes previous search_string if any
|
||||
search_string_display.text(i18n.t("You searched for:"));
|
||||
search_string_display.text($t({defaultMessage: "You searched for:"}));
|
||||
|
||||
// Add in stream:foo and topic:bar if present
|
||||
if (current_filter.has_operator("stream") || current_filter.has_operator("topic")) {
|
||||
@@ -55,7 +55,7 @@ function show_search_query() {
|
||||
}
|
||||
|
||||
if (query_contains_stop_words) {
|
||||
const preamble = i18n.t("Some common words were excluded from your search.");
|
||||
const preamble = $t({defaultMessage: "Some common words were excluded from your search."});
|
||||
search_string_display.html(_.escape(preamble) + "<br/>" + search_string_display.html());
|
||||
}
|
||||
}
|
||||
@@ -81,21 +81,24 @@ function pick_empty_narrow_banner() {
|
||||
let invalid_narrow_message = "";
|
||||
// No message can have multiple streams
|
||||
if (streams.length > 1) {
|
||||
invalid_narrow_message = i18n.t(
|
||||
invalid_narrow_message = $t({
|
||||
defaultMessage:
|
||||
"You are searching for messages that belong to more than one stream, which is not possible.",
|
||||
);
|
||||
});
|
||||
}
|
||||
// No message can have multiple topics
|
||||
if (current_filter.operands("topic").length > 1) {
|
||||
invalid_narrow_message = i18n.t(
|
||||
invalid_narrow_message = $t({
|
||||
defaultMessage:
|
||||
"You are searching for messages that belong to more than one topic, which is not possible.",
|
||||
);
|
||||
});
|
||||
}
|
||||
// No message can have multiple senders
|
||||
if (current_filter.operands("sender").length > 1) {
|
||||
invalid_narrow_message = i18n.t(
|
||||
invalid_narrow_message = $t({
|
||||
defaultMessage:
|
||||
"You are searching for messages that are sent by more than one person, which is not possible.",
|
||||
);
|
||||
});
|
||||
}
|
||||
if (invalid_narrow_message !== "") {
|
||||
set_invalid_narrow_message(invalid_narrow_message);
|
||||
@@ -186,13 +189,13 @@ export function show_empty_narrow_message() {
|
||||
pick_empty_narrow_banner().show();
|
||||
$("#left_bar_compose_reply_button_big").attr(
|
||||
"title",
|
||||
i18n.t("There are no messages to reply to."),
|
||||
$t({defaultMessage: "There are no messages to reply to."}),
|
||||
);
|
||||
$("#left_bar_compose_reply_button_big").prop("disabled", true);
|
||||
}
|
||||
|
||||
export function hide_empty_narrow_message() {
|
||||
$(".empty_feed_notice").hide();
|
||||
$("#left_bar_compose_reply_button_big").attr("title", i18n.t("Reply (r)"));
|
||||
$("#left_bar_compose_reply_button_big").attr("title", $t({defaultMessage: "Reply (r)"}));
|
||||
$("#left_bar_compose_reply_button_big").prop("disabled", false);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as alert_words from "./alert_words";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as favicon from "./favicon";
|
||||
import {$t, i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_lists from "./message_lists";
|
||||
import * as message_store from "./message_store";
|
||||
import * as muting from "./muting";
|
||||
@@ -515,7 +515,7 @@ function get_message_header(message) {
|
||||
);
|
||||
}
|
||||
if (people.is_current_user(message.reply_to)) {
|
||||
return i18n.t("private messages with yourself");
|
||||
return $t({defaultMessage: "private messages with yourself"});
|
||||
}
|
||||
return $t(
|
||||
{defaultMessage: "private messages with {recipient}"},
|
||||
@@ -532,11 +532,11 @@ export function get_local_notify_mix_reason(message) {
|
||||
}
|
||||
|
||||
if (message.type === "stream" && muting.is_topic_muted(message.stream_id, message.topic)) {
|
||||
return i18n.t("Sent! Your message was sent to a topic you have muted.");
|
||||
return $t({defaultMessage: "Sent! Your message was sent to a topic you have muted."});
|
||||
}
|
||||
|
||||
if (message.type === "stream" && stream_data.is_muted(message.stream_id)) {
|
||||
return i18n.t("Sent! Your message was sent to a stream you have muted.");
|
||||
return $t({defaultMessage: "Sent! Your message was sent to a stream you have muted."});
|
||||
}
|
||||
|
||||
// offscreen because it is outside narrow
|
||||
@@ -548,7 +548,7 @@ export function get_local_notify_mix_reason(message) {
|
||||
current_filter.can_apply_locally() &&
|
||||
!current_filter.predicate()(message)
|
||||
) {
|
||||
return i18n.t("Sent! Your message is outside your current narrow.");
|
||||
return $t({defaultMessage: "Sent! Your message is outside your current narrow."});
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -587,7 +587,7 @@ export function notify_local_mixes(messages, need_user_to_scroll) {
|
||||
|
||||
if (!reason) {
|
||||
if (need_user_to_scroll) {
|
||||
reason = i18n.t("Sent! Scroll down to view your message.");
|
||||
reason = $t({defaultMessage: "Sent! Scroll down to view your message."});
|
||||
notify_above_composebox(reason, "", null, "");
|
||||
setTimeout(() => {
|
||||
$("#out-of-view-notification").hide();
|
||||
@@ -601,9 +601,10 @@ export function notify_local_mixes(messages, need_user_to_scroll) {
|
||||
|
||||
const link_msg_id = message.id;
|
||||
const link_class = "compose_notification_narrow_by_topic";
|
||||
const link_text = i18n.t("Narrow to __- message_recipient__", {
|
||||
message_recipient: get_message_header(message),
|
||||
});
|
||||
const link_text = $t(
|
||||
{defaultMessage: "Narrow to {message_recipient}"},
|
||||
{message_recipient: get_message_header(message)},
|
||||
);
|
||||
|
||||
notify_above_composebox(reason, link_class, link_msg_id, link_text);
|
||||
}
|
||||
@@ -616,11 +617,12 @@ export function notify_messages_outside_current_search(messages) {
|
||||
if (!people.is_current_user(message.sender_email)) {
|
||||
continue;
|
||||
}
|
||||
const link_text = i18n.t("Narrow to __- message_recipient__", {
|
||||
message_recipient: get_message_header(message),
|
||||
});
|
||||
const link_text = $t(
|
||||
{defaultMessage: "Narrow to {message_recipient}"},
|
||||
{message_recipient: get_message_header(message)},
|
||||
);
|
||||
notify_above_composebox(
|
||||
i18n.t("Sent! Your recent message is outside the current search."),
|
||||
$t({defaultMessage: "Sent! Your recent message is outside the current search."}),
|
||||
"compose_notification_narrow_by_topic",
|
||||
message.id,
|
||||
link_text,
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as typeahead from "../shared/js/typeahead";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import {FoldDict} from "./fold_dict";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_user_ids from "./message_user_ids";
|
||||
import * as reload_state from "./reload_state";
|
||||
import * as settings_data from "./settings_data";
|
||||
@@ -266,15 +266,15 @@ export function get_user_type(user_id) {
|
||||
const user_profile = get_by_user_id(user_id);
|
||||
|
||||
if (user_profile.is_owner) {
|
||||
return i18n.t("Owner");
|
||||
return $t({defaultMessage: "Owner"});
|
||||
} else if (user_profile.is_admin) {
|
||||
return i18n.t("Administrator");
|
||||
return $t({defaultMessage: "Administrator"});
|
||||
} else if (user_profile.is_guest) {
|
||||
return i18n.t("Guest");
|
||||
return $t({defaultMessage: "Guest"});
|
||||
} else if (user_profile.is_bot) {
|
||||
return i18n.t("Bot");
|
||||
return $t({defaultMessage: "Bot"});
|
||||
}
|
||||
return i18n.t("Member");
|
||||
return $t({defaultMessage: "Member"});
|
||||
}
|
||||
|
||||
export function emails_strings_to_user_ids_string(emails_string) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import * as emoji_picker from "./emoji_picker";
|
||||
import * as feature_flags from "./feature_flags";
|
||||
import * as giphy from "./giphy";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_edit from "./message_edit";
|
||||
import * as message_edit_history from "./message_edit_history";
|
||||
import * as message_lists from "./message_lists";
|
||||
@@ -110,7 +110,7 @@ function copy_email_handler(e) {
|
||||
const email_textnode = email_el[0].childNodes[2];
|
||||
|
||||
email_el.addClass("email_copied");
|
||||
email_textnode.nodeValue = i18n.t("Email copied");
|
||||
email_textnode.nodeValue = $t({defaultMessage: "Email copied"});
|
||||
|
||||
setTimeout(() => {
|
||||
email_el.removeClass("email_copied");
|
||||
@@ -528,13 +528,13 @@ export function toggle_actions_popover(element, id) {
|
||||
let editability_menu_item;
|
||||
if (editability === message_edit.editability_types.FULL) {
|
||||
use_edit_icon = true;
|
||||
editability_menu_item = i18n.t("Edit");
|
||||
editability_menu_item = $t({defaultMessage: "Edit"});
|
||||
} else if (editability === message_edit.editability_types.TOPIC_ONLY) {
|
||||
use_edit_icon = false;
|
||||
editability_menu_item = i18n.t("View source / Edit topic");
|
||||
editability_menu_item = $t({defaultMessage: "View source / Edit topic"});
|
||||
} else {
|
||||
use_edit_icon = false;
|
||||
editability_menu_item = i18n.t("View source");
|
||||
editability_menu_item = $t({defaultMessage: "View source"});
|
||||
}
|
||||
const topic = message.topic;
|
||||
const can_mute_topic =
|
||||
@@ -1278,7 +1278,7 @@ export function register_click_handlers() {
|
||||
const message_id = $(this).attr("data-message-id");
|
||||
const row = $(`[zid='${CSS.escape(message_id)}']`);
|
||||
row.find(".alert-msg")
|
||||
.text(i18n.t("Copied!"))
|
||||
.text($t({defaultMessage: "Copied!"}))
|
||||
.css("display", "block")
|
||||
.delay(1000)
|
||||
.fadeOut(300);
|
||||
|
||||
@@ -3,7 +3,7 @@ import _ from "lodash";
|
||||
|
||||
import * as blueslip from "../blueslip";
|
||||
import * as common from "../common";
|
||||
import {i18n} from "../i18n";
|
||||
import {$t} from "../i18n";
|
||||
|
||||
import * as google_analytics from "./google-analytics";
|
||||
import {path_parts} from "./landing-page";
|
||||
@@ -89,7 +89,7 @@ function update_categories() {
|
||||
|
||||
const $dropdown_label = $(".integration-categories-dropdown .dropdown-category-label");
|
||||
if (state.category === INITIAL_STATE.category) {
|
||||
$dropdown_label.text(i18n.t("Filter by category"));
|
||||
$dropdown_label.text($t({defaultMessage: "Filter by category"}));
|
||||
} else {
|
||||
$dropdown_label.text(CATEGORIES.get(state.category));
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import render_message_reaction from "../templates/message_reaction.hbs";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as emoji_picker from "./emoji_picker";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_lists from "./message_lists";
|
||||
import * as message_store from "./message_store";
|
||||
import {page_params} from "./page_params";
|
||||
@@ -165,16 +165,19 @@ function generate_title(emoji_name, user_ids) {
|
||||
|
||||
if (user_ids.length === 1) {
|
||||
if (current_user_reacted) {
|
||||
return i18n.t("You (click to remove) reacted with __- emoji_name__", context);
|
||||
return $t({defaultMessage: "You (click to remove) reacted with {emoji_name}"}, context);
|
||||
}
|
||||
context.username = usernames[0];
|
||||
return i18n.t("__- username__ reacted with __- emoji_name__", context);
|
||||
return $t({defaultMessage: "{username} reacted with {emoji_name}"}, context);
|
||||
}
|
||||
|
||||
if (user_ids.length === 2 && current_user_reacted) {
|
||||
context.other_username = usernames[0];
|
||||
return i18n.t(
|
||||
"You (click to remove) and __- other_username__ reacted with __- emoji_name__",
|
||||
return $t(
|
||||
{
|
||||
defaultMessage:
|
||||
"You (click to remove) and {other_username} reacted with {emoji_name}",
|
||||
},
|
||||
context,
|
||||
);
|
||||
}
|
||||
@@ -182,13 +185,19 @@ function generate_title(emoji_name, user_ids) {
|
||||
context.comma_separated_usernames = _.initial(usernames).join(", ");
|
||||
context.last_username = _.last(usernames);
|
||||
if (current_user_reacted) {
|
||||
return i18n.t(
|
||||
"You (click to remove), __- comma_separated_usernames__ and __- last_username__ reacted with __- emoji_name__",
|
||||
return $t(
|
||||
{
|
||||
defaultMessage:
|
||||
"You (click to remove), {comma_separated_usernames} and {last_username} reacted with {emoji_name}",
|
||||
},
|
||||
context,
|
||||
);
|
||||
}
|
||||
return i18n.t(
|
||||
"__- comma_separated_usernames__ and __- last_username__ reacted with __- emoji_name__",
|
||||
return $t(
|
||||
{
|
||||
defaultMessage:
|
||||
"{comma_separated_usernames} and {last_username} reacted with {emoji_name}",
|
||||
},
|
||||
context,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import _ from "lodash";
|
||||
import * as channel from "./channel";
|
||||
import * as compose from "./compose";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as message_lists from "./message_lists";
|
||||
import * as notifications from "./notifications";
|
||||
import {page_params} from "./page_params";
|
||||
@@ -117,7 +117,7 @@ export function do_set_reminder_for_message(message_id, timestamp) {
|
||||
const row = $(`[zid='${CSS.escape(message_id)}']`);
|
||||
function error() {
|
||||
row.find(".alert-msg")
|
||||
.text(i18n.t("Reminder not set!"))
|
||||
.text($t({defaultMessage: "Reminder not set!"}))
|
||||
.css("display", "block")
|
||||
.css("color", "#b94a48")
|
||||
.delay(1000)
|
||||
@@ -163,7 +163,7 @@ export function do_set_reminder_for_message(message_id, timestamp) {
|
||||
|
||||
function success() {
|
||||
row.find(".alert-msg")
|
||||
.text(i18n.t("Reminder set!"))
|
||||
.text($t({defaultMessage: "Reminder set!"}))
|
||||
.css("display", "block")
|
||||
.delay(1000)
|
||||
.fadeOut(300);
|
||||
|
||||
@@ -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 {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
import * as rtl from "./rtl";
|
||||
@@ -179,7 +179,10 @@ export const update_elements = (content) => {
|
||||
|
||||
content.find("span.timestamp-error").each(function () {
|
||||
const time_str = $(this).text().replace("Invalid time format: ", "");
|
||||
const text = i18n.t("Invalid time format: __timestamp__", {timestamp: time_str});
|
||||
const text = $t(
|
||||
{defaultMessage: "Invalid time format: {timestamp}"},
|
||||
{timestamp: time_str},
|
||||
);
|
||||
$(this).text(text);
|
||||
});
|
||||
|
||||
@@ -210,13 +213,14 @@ export const update_elements = (content) => {
|
||||
// offer to view the code in that playground. When
|
||||
// there are multiple playgrounds, we display a
|
||||
// popover listing the options.
|
||||
let title = i18n.t("View in playground");
|
||||
let title = $t({defaultMessage: "View in playground"});
|
||||
const view_in_playground_button = $(view_code_in_playground());
|
||||
$pre.prepend(view_in_playground_button);
|
||||
if (playground_info.length === 1) {
|
||||
title = i18n.t("View in __playground_name__", {
|
||||
playground_name: playground_info[0].name,
|
||||
});
|
||||
title = $t(
|
||||
{defaultMessage: "View in {playground_name}"},
|
||||
{playground_name: playground_info[0].name},
|
||||
);
|
||||
} else {
|
||||
view_in_playground_button.attr("aria-haspopup", "true");
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import render_settings_tab from "../templates/settings_tab.hbs";
|
||||
|
||||
import * as admin from "./admin";
|
||||
import * as blueslip from "./blueslip";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as overlays from "./overlays";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
@@ -41,32 +41,38 @@ $("body").ready(() => {
|
||||
function setup_settings_label() {
|
||||
settings_label = {
|
||||
// settings_notification
|
||||
enable_online_push_notifications: i18n.t(
|
||||
"Send mobile notifications even if I'm online (useful for testing)",
|
||||
),
|
||||
pm_content_in_desktop_notifications: i18n.t(
|
||||
"Include content of private messages in desktop notifications",
|
||||
),
|
||||
desktop_icon_count_display: i18n.t(
|
||||
"Unread count summary (appears in desktop sidebar and browser tab)",
|
||||
),
|
||||
enable_digest_emails: i18n.t("Send digest emails when I'm away"),
|
||||
enable_login_emails: i18n.t("Send email notifications for new logins to my account"),
|
||||
message_content_in_email_notifications: i18n.t(
|
||||
"Include message content in missed message emails",
|
||||
),
|
||||
realm_name_in_notifications: i18n.t(
|
||||
"Include organization name in subject of missed message emails",
|
||||
),
|
||||
presence_enabled: i18n.t("Display my availability to other users when online"),
|
||||
enable_online_push_notifications: $t({
|
||||
defaultMessage: "Send mobile notifications even if I'm online (useful for testing)",
|
||||
}),
|
||||
pm_content_in_desktop_notifications: $t({
|
||||
defaultMessage: "Include content of private messages in desktop notifications",
|
||||
}),
|
||||
desktop_icon_count_display: $t({
|
||||
defaultMessage: "Unread count summary (appears in desktop sidebar and browser tab)",
|
||||
}),
|
||||
enable_digest_emails: $t({defaultMessage: "Send digest emails when I'm away"}),
|
||||
enable_login_emails: $t({
|
||||
defaultMessage: "Send email notifications for new logins to my account",
|
||||
}),
|
||||
message_content_in_email_notifications: $t({
|
||||
defaultMessage: "Include message content in missed message emails",
|
||||
}),
|
||||
realm_name_in_notifications: $t({
|
||||
defaultMessage: "Include organization name in subject of missed message emails",
|
||||
}),
|
||||
presence_enabled: $t({
|
||||
defaultMessage: "Display my availability to other users when online",
|
||||
}),
|
||||
|
||||
// display settings
|
||||
dense_mode: i18n.t("Dense mode"),
|
||||
fluid_layout_width: i18n.t("Use full width on wide screens"),
|
||||
high_contrast_mode: i18n.t("High contrast mode"),
|
||||
left_side_userlist: i18n.t("Show user list on left sidebar in narrow windows"),
|
||||
starred_message_counts: i18n.t("Show counts for starred messages"),
|
||||
twenty_four_hour_time: i18n.t("Time format"),
|
||||
dense_mode: $t({defaultMessage: "Dense mode"}),
|
||||
fluid_layout_width: $t({defaultMessage: "Use full width on wide screens"}),
|
||||
high_contrast_mode: $t({defaultMessage: "High contrast mode"}),
|
||||
left_side_userlist: $t({
|
||||
defaultMessage: "Show user list on left sidebar in narrow windows",
|
||||
}),
|
||||
starred_message_counts: $t({defaultMessage: "Show counts for starred messages"}),
|
||||
twenty_four_hour_time: $t({defaultMessage: "Time format"}),
|
||||
translate_emoticons: new Handlebars.SafeString(
|
||||
$t_html({
|
||||
defaultMessage: "Convert emoticons before sending (<code>:)</code> becomes 😃)",
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as bot_data from "./bot_data";
|
||||
import * as channel from "./channel";
|
||||
import {csrf_token} from "./csrf";
|
||||
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as loading from "./loading";
|
||||
import * as overlays from "./overlays";
|
||||
import {page_params} from "./page_params";
|
||||
@@ -184,15 +184,17 @@ export function generate_botserverrc_content(email, api_key, token) {
|
||||
export const bot_creation_policy_values = {
|
||||
admins_only: {
|
||||
code: 3,
|
||||
description: i18n.t("Admins"),
|
||||
description: $t({defaultMessage: "Admins"}),
|
||||
},
|
||||
everyone: {
|
||||
code: 1,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
restricted: {
|
||||
code: 2,
|
||||
description: i18n.t("Admins and members, but only admins can add generic bots"),
|
||||
description: $t({
|
||||
defaultMessage: "Admins and members, but only admins can add generic bots",
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -213,11 +215,13 @@ export function update_bot_settings_tip() {
|
||||
const current_permission = page_params.realm_bot_creation_policy;
|
||||
let tip_text;
|
||||
if (current_permission === permission_type.admins_only.code) {
|
||||
tip_text = i18n.t("Only organization administrators can add bots to this organization");
|
||||
tip_text = $t({
|
||||
defaultMessage: "Only organization administrators can add bots to this organization",
|
||||
});
|
||||
} else if (current_permission === permission_type.restricted.code) {
|
||||
tip_text = i18n.t("Only organization administrators can add generic bots");
|
||||
tip_text = $t({defaultMessage: "Only organization administrators can add generic bots"});
|
||||
} else {
|
||||
tip_text = i18n.t("Anyone in this organization can add bots");
|
||||
tip_text = $t({defaultMessage: "Anyone in this organization can add bots"});
|
||||
}
|
||||
$(".bot-settings-tip").text(tip_text);
|
||||
}
|
||||
@@ -318,7 +322,7 @@ export function set_up() {
|
||||
)) {
|
||||
formData.append("file-" + i, file);
|
||||
}
|
||||
loading.make_indicator(spinner, {text: i18n.t("Creating bot")});
|
||||
loading.make_indicator(spinner, {text: $t({defaultMessage: "Creating bot"})});
|
||||
channel.post({
|
||||
url: "/json/bots",
|
||||
data: formData,
|
||||
@@ -455,7 +459,7 @@ export function set_up() {
|
||||
const opts = {
|
||||
widget_name: "bot_owner",
|
||||
data: users_list,
|
||||
default_text: i18n.t("No owner"),
|
||||
default_text: $t({defaultMessage: "No owner"}),
|
||||
value: bot.owner_id,
|
||||
};
|
||||
const owner_widget = dropdown_list_widget(opts);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import {page_params} from "./page_params";
|
||||
|
||||
/*
|
||||
@@ -18,52 +18,52 @@ import {page_params} from "./page_params";
|
||||
export const demote_inactive_streams_values = {
|
||||
automatic: {
|
||||
code: 1,
|
||||
description: i18n.t("Automatic"),
|
||||
description: $t({defaultMessage: "Automatic"}),
|
||||
},
|
||||
always: {
|
||||
code: 2,
|
||||
description: i18n.t("Always"),
|
||||
description: $t({defaultMessage: "Always"}),
|
||||
},
|
||||
never: {
|
||||
code: 3,
|
||||
description: i18n.t("Never"),
|
||||
description: $t({defaultMessage: "Never"}),
|
||||
},
|
||||
};
|
||||
|
||||
export const default_view_values = {
|
||||
recent_topics: {
|
||||
code: "recent_topics",
|
||||
description: i18n.t("Recent topics"),
|
||||
description: $t({defaultMessage: "Recent topics"}),
|
||||
},
|
||||
all_messages: {
|
||||
code: "all_messages",
|
||||
description: i18n.t("All messages"),
|
||||
description: $t({defaultMessage: "All messages"}),
|
||||
},
|
||||
};
|
||||
|
||||
export const color_scheme_values = {
|
||||
automatic: {
|
||||
code: 1,
|
||||
description: i18n.t("Automatic"),
|
||||
description: $t({defaultMessage: "Automatic"}),
|
||||
},
|
||||
night: {
|
||||
code: 2,
|
||||
description: i18n.t("Night mode"),
|
||||
description: $t({defaultMessage: "Night mode"}),
|
||||
},
|
||||
day: {
|
||||
code: 3,
|
||||
description: i18n.t("Day mode"),
|
||||
description: $t({defaultMessage: "Day mode"}),
|
||||
},
|
||||
};
|
||||
|
||||
export const twenty_four_hour_time_values = {
|
||||
twenty_four_hour_clock: {
|
||||
value: true,
|
||||
description: i18n.t("24-hour clock (17:00)"),
|
||||
description: $t({defaultMessage: "24-hour clock (17:00)"}),
|
||||
},
|
||||
twelve_hour_clock: {
|
||||
value: false,
|
||||
description: i18n.t("12-hour clock (5:00 PM)"),
|
||||
description: $t({defaultMessage: "12-hour clock (5:00 PM)"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ export const get_all_display_settings = () => ({
|
||||
export const email_address_visibility_values = {
|
||||
everyone: {
|
||||
code: 1,
|
||||
description: i18n.t("Admins, members, and guests"),
|
||||
description: $t({defaultMessage: "Admins, members, and guests"}),
|
||||
},
|
||||
// // Backend support for this configuration is not available yet.
|
||||
// admins_and_members: {
|
||||
@@ -95,11 +95,11 @@ export const email_address_visibility_values = {
|
||||
// },
|
||||
admins_only: {
|
||||
code: 3,
|
||||
description: i18n.t("Admins only"),
|
||||
description: $t({defaultMessage: "Admins only"}),
|
||||
},
|
||||
nobody: {
|
||||
code: 4,
|
||||
description: i18n.t("Nobody"),
|
||||
description: $t({defaultMessage: "Nobody"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -107,17 +107,17 @@ export const create_stream_policy_values = {
|
||||
by_admins_only: {
|
||||
order: 1,
|
||||
code: 2,
|
||||
description: i18n.t("Admins"),
|
||||
description: $t({defaultMessage: "Admins"}),
|
||||
},
|
||||
by_full_members: {
|
||||
order: 2,
|
||||
code: 3,
|
||||
description: i18n.t("Admins and full members"),
|
||||
description: $t({defaultMessage: "Admins and full members"}),
|
||||
},
|
||||
by_members: {
|
||||
order: 3,
|
||||
code: 1,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -132,12 +132,12 @@ export const user_group_edit_policy_values = {
|
||||
by_admins_only: {
|
||||
order: 1,
|
||||
code: 2,
|
||||
description: i18n.t("Admins"),
|
||||
description: $t({defaultMessage: "Admins"}),
|
||||
},
|
||||
by_members: {
|
||||
order: 2,
|
||||
code: 1,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -145,12 +145,12 @@ export const private_message_policy_values = {
|
||||
by_anyone: {
|
||||
order: 1,
|
||||
code: 1,
|
||||
description: i18n.t("Admins, members, and guests"),
|
||||
description: $t({defaultMessage: "Admins, members, and guests"}),
|
||||
},
|
||||
disabled: {
|
||||
order: 2,
|
||||
code: 2,
|
||||
description: i18n.t("Private messages disabled"),
|
||||
description: $t({defaultMessage: "Private messages disabled"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -158,17 +158,17 @@ export const wildcard_mention_policy_values = {
|
||||
by_everyone: {
|
||||
order: 1,
|
||||
code: 1,
|
||||
description: i18n.t("Admins, members and guests"),
|
||||
description: $t({defaultMessage: "Admins, members and guests"}),
|
||||
},
|
||||
by_members: {
|
||||
order: 2,
|
||||
code: 2,
|
||||
description: i18n.t("Admins and members"),
|
||||
description: $t({defaultMessage: "Admins and members"}),
|
||||
},
|
||||
by_full_members: {
|
||||
order: 3,
|
||||
code: 3,
|
||||
description: i18n.t("Admins and full members"),
|
||||
description: $t({defaultMessage: "Admins and full members"}),
|
||||
},
|
||||
// Until we add stream administrators, we mislabel this choice
|
||||
// (which we intend to be the long-term default) as "Admins only"
|
||||
@@ -177,7 +177,7 @@ export const wildcard_mention_policy_values = {
|
||||
order: 4,
|
||||
code: 4,
|
||||
// description: i18n.t("Organization and stream admins"),
|
||||
description: i18n.t("Admins only"),
|
||||
description: $t({defaultMessage: "Admins only"}),
|
||||
},
|
||||
// by_admins_only: {
|
||||
// order: 5,
|
||||
@@ -187,7 +187,7 @@ export const wildcard_mention_policy_values = {
|
||||
nobody: {
|
||||
order: 6,
|
||||
code: 6,
|
||||
description: i18n.t("Nobody"),
|
||||
description: $t({defaultMessage: "Nobody"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -195,55 +195,70 @@ const time_limit_dropdown_values = new Map([
|
||||
[
|
||||
"any_time",
|
||||
{
|
||||
text: i18n.t("Any time"),
|
||||
text: $t({defaultMessage: "Any time"}),
|
||||
seconds: 0,
|
||||
},
|
||||
],
|
||||
[
|
||||
"never",
|
||||
{
|
||||
text: i18n.t("Never"),
|
||||
text: $t({defaultMessage: "Never"}),
|
||||
},
|
||||
],
|
||||
[
|
||||
"upto_two_min",
|
||||
{
|
||||
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("2 minutes")}),
|
||||
text: $t(
|
||||
{defaultMessage: "Up to {time_limit} after posting"},
|
||||
{time_limit: $t({defaultMessage: "2 minutes"})},
|
||||
),
|
||||
seconds: 2 * 60,
|
||||
},
|
||||
],
|
||||
[
|
||||
"upto_ten_min",
|
||||
{
|
||||
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("10 minutes")}),
|
||||
text: $t(
|
||||
{defaultMessage: "Up to {time_limit} after posting"},
|
||||
{time_limit: $t({defaultMessage: "10 minutes"})},
|
||||
),
|
||||
seconds: 10 * 60,
|
||||
},
|
||||
],
|
||||
[
|
||||
"upto_one_hour",
|
||||
{
|
||||
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("1 hour")}),
|
||||
text: $t(
|
||||
{defaultMessage: "Up to {time_limit} after posting"},
|
||||
{time_limit: $t({defaultMessage: "1 hour"})},
|
||||
),
|
||||
seconds: 60 * 60,
|
||||
},
|
||||
],
|
||||
[
|
||||
"upto_one_day",
|
||||
{
|
||||
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("1 day")}),
|
||||
text: $t(
|
||||
{defaultMessage: "Up to {time_limit} after posting"},
|
||||
{time_limit: $t({defaultMessage: "1 day"})},
|
||||
),
|
||||
seconds: 24 * 60 * 60,
|
||||
},
|
||||
],
|
||||
[
|
||||
"upto_one_week",
|
||||
{
|
||||
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("1 week")}),
|
||||
text: $t(
|
||||
{defaultMessage: "Up to {time_limit} after posting"},
|
||||
{time_limit: $t({defaultMessage: "1 week"})},
|
||||
),
|
||||
seconds: 7 * 24 * 60 * 60,
|
||||
},
|
||||
],
|
||||
[
|
||||
"custom_limit",
|
||||
{
|
||||
text: i18n.t("Up to N minutes after posting"),
|
||||
text: $t({defaultMessage: "Up to N minutes after posting"}),
|
||||
},
|
||||
],
|
||||
]);
|
||||
@@ -254,19 +269,19 @@ export const retain_message_forever = -1;
|
||||
export const user_role_values = {
|
||||
guest: {
|
||||
code: 600,
|
||||
description: i18n.t("Guest"),
|
||||
description: $t({defaultMessage: "Guest"}),
|
||||
},
|
||||
member: {
|
||||
code: 400,
|
||||
description: i18n.t("Member"),
|
||||
description: $t({defaultMessage: "Member"}),
|
||||
},
|
||||
admin: {
|
||||
code: 200,
|
||||
description: i18n.t("Administrator"),
|
||||
description: $t({defaultMessage: "Administrator"}),
|
||||
},
|
||||
owner: {
|
||||
code: 100,
|
||||
description: i18n.t("Owner"),
|
||||
description: $t({defaultMessage: "Owner"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -288,13 +303,13 @@ export const general_notifications_table_labels = {
|
||||
"all_mentions",
|
||||
],
|
||||
stream: {
|
||||
is_muted: i18n.t("Mute stream"),
|
||||
desktop_notifications: i18n.t("Visual desktop notifications"),
|
||||
audible_notifications: i18n.t("Audible desktop notifications"),
|
||||
push_notifications: i18n.t("Mobile notifications"),
|
||||
email_notifications: i18n.t("Email notifications"),
|
||||
pin_to_top: i18n.t("Pin stream to top of left sidebar"),
|
||||
wildcard_mentions_notify: i18n.t("Notifications for @all/@everyone mentions"),
|
||||
is_muted: $t({defaultMessage: "Mute stream"}),
|
||||
desktop_notifications: $t({defaultMessage: "Visual desktop notifications"}),
|
||||
audible_notifications: $t({defaultMessage: "Audible desktop notifications"}),
|
||||
push_notifications: $t({defaultMessage: "Mobile notifications"}),
|
||||
email_notifications: $t({defaultMessage: "Email notifications"}),
|
||||
pin_to_top: $t({defaultMessage: "Pin stream to top of left sidebar"}),
|
||||
wildcard_mentions_notify: $t({defaultMessage: "Notifications for @all/@everyone mentions"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -372,11 +387,11 @@ export function get_notifications_table_row_data(notify_settings) {
|
||||
export const all_notifications = () => ({
|
||||
general_settings: [
|
||||
{
|
||||
label: i18n.t("Streams"),
|
||||
label: $t({defaultMessage: "Streams"}),
|
||||
notification_settings: get_notifications_table_row_data(stream_notification_settings),
|
||||
},
|
||||
{
|
||||
label: i18n.t("PMs, mentions, and alerts"),
|
||||
label: $t({defaultMessage: "PMs, mentions, and alerts"}),
|
||||
notification_settings: get_notifications_table_row_data(
|
||||
pm_mention_notification_settings,
|
||||
),
|
||||
@@ -446,14 +461,14 @@ export const get_playground_info_for_languages = (lang) => map_language_to_playg
|
||||
export const desktop_icon_count_display_values = {
|
||||
messages: {
|
||||
code: 1,
|
||||
description: i18n.t("All unreads"),
|
||||
description: $t({defaultMessage: "All unreads"}),
|
||||
},
|
||||
notifiable: {
|
||||
code: 2,
|
||||
description: i18n.t("Private messages and mentions"),
|
||||
description: $t({defaultMessage: "Private messages and mentions"}),
|
||||
},
|
||||
none: {
|
||||
code: 3,
|
||||
description: i18n.t("None"),
|
||||
description: $t({defaultMessage: "None"}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ import render_settings_revoke_invite_modal from "../templates/settings/revoke_in
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as ListWidget from "./list_widget";
|
||||
import * as loading from "./loading";
|
||||
import {page_params} from "./page_params";
|
||||
@@ -113,7 +113,7 @@ function do_revoke_invite() {
|
||||
);
|
||||
}
|
||||
$("#revoke_invite_modal").modal("hide");
|
||||
revoke_button.prop("disabled", true).text(i18n.t("Working…"));
|
||||
revoke_button.prop("disabled", true).text($t({defaultMessage: "Working…"}));
|
||||
let url = "/json/invites/" + meta.invite_id;
|
||||
|
||||
if (modal_is_multiuse === "true") {
|
||||
@@ -214,14 +214,14 @@ export function on_load_success(invites_data, initialize_event_handlers) {
|
||||
);
|
||||
}
|
||||
$("#resend_invite_modal").modal("hide");
|
||||
resend_button.prop("disabled", true).text(i18n.t("Working…"));
|
||||
resend_button.prop("disabled", true).text($t({defaultMessage: "Working…"}));
|
||||
channel.post({
|
||||
url: "/json/invites/" + meta.invite_id + "/resend",
|
||||
error(xhr) {
|
||||
ui_report.generic_row_button_error(xhr, resend_button);
|
||||
},
|
||||
success(data) {
|
||||
resend_button.text(i18n.t("Sent!"));
|
||||
resend_button.text($t({defaultMessage: "Sent!"}));
|
||||
resend_button.removeClass("resend btn-warning").addClass("sea-green");
|
||||
data.timestamp = timerender.absolute_time(data.timestamp * 1000);
|
||||
meta.current_resend_invite_user_modal_row.find(".invited_at").text(data.timestamp);
|
||||
|
||||
@@ -3,7 +3,7 @@ import $ from "jquery";
|
||||
import render_stream_specific_notification_row from "../templates/settings/stream_specific_notification_row.hbs";
|
||||
|
||||
import * as channel from "./channel";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as notifications from "./notifications";
|
||||
import {page_params} from "./page_params";
|
||||
import * as settings_config from "./settings_config";
|
||||
@@ -87,7 +87,7 @@ export function set_up() {
|
||||
|
||||
$("#send_test_notification").on("click", () => {
|
||||
notifications.send_test_notification(
|
||||
i18n.t("This is what a Zulip notification looks like."),
|
||||
$t({defaultMessage: "This is what a Zulip notification looks like."}),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import {csrf_token} from "./csrf";
|
||||
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as loading from "./loading";
|
||||
import * as overlays from "./overlays";
|
||||
import {page_params} from "./page_params";
|
||||
@@ -328,9 +328,9 @@ export function populate_realm_domains(realm_domains) {
|
||||
);
|
||||
let domains = domains_list.join(", ");
|
||||
if (domains.length === 0) {
|
||||
domains = i18n.t("None");
|
||||
domains = $t({defaultMessage: "None"});
|
||||
}
|
||||
$("#allowed_domains_label").text(i18n.t("Allowed domains: __domains__", {domains}));
|
||||
$("#allowed_domains_label").text($t({defaultMessage: "Allowed domains: {domains}"}, {domains}));
|
||||
|
||||
const realm_domains_table_body = $("#realm_domains_table tbody").expectOne();
|
||||
realm_domains_table_body.find("tr").remove();
|
||||
@@ -493,28 +493,28 @@ export function change_save_button_state($element, state) {
|
||||
let data_status;
|
||||
let is_show;
|
||||
if (state === "unsaved") {
|
||||
button_text = i18n.t("Save changes");
|
||||
button_text = $t({defaultMessage: "Save changes"});
|
||||
data_status = "unsaved";
|
||||
is_show = true;
|
||||
|
||||
$element.find(".discard-button").show();
|
||||
} else if (state === "saved") {
|
||||
button_text = i18n.t("Save changes");
|
||||
button_text = $t({defaultMessage: "Save changes"});
|
||||
data_status = "";
|
||||
is_show = false;
|
||||
} else if (state === "saving") {
|
||||
button_text = i18n.t("Saving");
|
||||
button_text = $t({defaultMessage: "Saving"});
|
||||
data_status = "saving";
|
||||
is_show = true;
|
||||
|
||||
$element.find(".discard-button").hide();
|
||||
$saveBtn.addClass("saving");
|
||||
} else if (state === "failed") {
|
||||
button_text = i18n.t("Save changes");
|
||||
button_text = $t({defaultMessage: "Save changes"});
|
||||
data_status = "failed";
|
||||
is_show = true;
|
||||
} else if (state === "succeeded") {
|
||||
button_text = i18n.t("Saved");
|
||||
button_text = $t({defaultMessage: "Saved"});
|
||||
data_status = "saved";
|
||||
is_show = false;
|
||||
}
|
||||
@@ -628,7 +628,7 @@ export function init_dropdown_widgets() {
|
||||
on_update: () => {
|
||||
save_discard_widget_status_handler($("#org-notifications"));
|
||||
},
|
||||
default_text: i18n.t("Disabled"),
|
||||
default_text: $t({defaultMessage: "Disabled"}),
|
||||
render_text: (x) => `#${x}`,
|
||||
null_value: -1,
|
||||
};
|
||||
@@ -652,7 +652,7 @@ export function init_dropdown_widgets() {
|
||||
on_update: () => {
|
||||
save_discard_widget_status_handler($("#org-other-settings"));
|
||||
},
|
||||
default_text: i18n.t("No language set"),
|
||||
default_text: $t({defaultMessage: "No language set"}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import * as components from "./components";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as settings_panel_menu from "./settings_panel_menu";
|
||||
|
||||
let toggler;
|
||||
@@ -16,8 +16,8 @@ export function initialize() {
|
||||
toggler = components.toggle({
|
||||
child_wants_focus: true,
|
||||
values: [
|
||||
{label: i18n.t("Settings"), key: "settings"},
|
||||
{label: i18n.t("Organization"), key: "organization"},
|
||||
{label: $t({defaultMessage: "Settings"}), key: "settings"},
|
||||
{label: $t({defaultMessage: "Organization"}), key: "organization"},
|
||||
],
|
||||
callback(name, key) {
|
||||
if (key === "organization") {
|
||||
@@ -36,8 +36,8 @@ export function initialize() {
|
||||
// Handles the collapse/reveal of some tabs in the org settings for non-admins.
|
||||
export function toggle_org_setting_collapse() {
|
||||
const is_collapsed = $(".collapse-org-settings").hasClass("hide-org-settings");
|
||||
const show_fewer_settings_text = i18n.t("Show fewer");
|
||||
const show_more_settings_text = i18n.t("Show more");
|
||||
const show_fewer_settings_text = $t({defaultMessage: "Show fewer"});
|
||||
const show_more_settings_text = $t({defaultMessage: "Show more"});
|
||||
|
||||
if (is_collapsed) {
|
||||
for (const elem of $(".collapse-org-settings")) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as loading from "./loading";
|
||||
import * as ui_report from "./ui_report";
|
||||
|
||||
@@ -14,7 +14,7 @@ export function display_checkmark($elem) {
|
||||
export const strings = {
|
||||
success_html: $t_html({defaultMessage: "Saved"}),
|
||||
failure_html: $t_html({defaultMessage: "Save failed"}),
|
||||
saving: i18n.t("Saving"),
|
||||
saving: $t({defaultMessage: "Saving"}),
|
||||
};
|
||||
|
||||
// Generic function for informing users about changes to the settings
|
||||
|
||||
@@ -6,7 +6,7 @@ import render_confirm_delete_user from "../templates/confirm_delete_user.hbs";
|
||||
|
||||
import * as channel from "./channel";
|
||||
import * as confirm_dialog from "./confirm_dialog";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
import * as pill_typeahead from "./pill_typeahead";
|
||||
@@ -353,7 +353,7 @@ export function set_up() {
|
||||
id: group_id,
|
||||
},
|
||||
error() {
|
||||
btn.text(i18n.t("Failed!"));
|
||||
btn.text($t({defaultMessage: "Failed!"}));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as blueslip from "./blueslip";
|
||||
import * as bot_data from "./bot_data";
|
||||
import * as channel from "./channel";
|
||||
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as ListWidget from "./list_widget";
|
||||
import * as loading from "./loading";
|
||||
import * as overlays from "./overlays";
|
||||
@@ -115,7 +115,7 @@ function update_view_on_deactivate(row) {
|
||||
const user_id = row.data("user-id");
|
||||
user_role.text(
|
||||
"%state (%role)"
|
||||
.replace("%state", i18n.t("Deactivated"))
|
||||
.replace("%state", $t({defaultMessage: "Deactivated"}))
|
||||
.replace("%role", people.get_user_type(user_id)),
|
||||
);
|
||||
}
|
||||
@@ -216,7 +216,7 @@ function bot_info(bot_user_id) {
|
||||
|
||||
if (!info.bot_owner_full_name) {
|
||||
info.no_owner = true;
|
||||
info.bot_owner_full_name = i18n.t("No owner");
|
||||
info.bot_owner_full_name = $t({defaultMessage: "No owner"});
|
||||
}
|
||||
|
||||
info.is_current_user = false;
|
||||
@@ -232,7 +232,7 @@ function get_last_active(user) {
|
||||
const last_active_date = presence.last_active_date(user.user_id);
|
||||
|
||||
if (!last_active_date) {
|
||||
return i18n.t("Unknown");
|
||||
return $t({defaultMessage: "Unknown"});
|
||||
}
|
||||
return timerender.render_now(last_active_date).time_str;
|
||||
}
|
||||
@@ -500,7 +500,7 @@ function open_bot_form(person) {
|
||||
const opts = {
|
||||
widget_name: "edit_bot_owner",
|
||||
data: users_list,
|
||||
default_text: i18n.t("No owner"),
|
||||
default_text: $t({defaultMessage: "No owner"}),
|
||||
value: owner_id,
|
||||
};
|
||||
const owner_widget = dropdown_list_widget(opts);
|
||||
@@ -525,13 +525,13 @@ function confirm_deactivation(row, user_id, status_field) {
|
||||
|
||||
modal_elem.modal("hide");
|
||||
const row_deactivate_button = row.find("button.deactivate");
|
||||
row_deactivate_button.prop("disabled", true).text(i18n.t("Working…"));
|
||||
row_deactivate_button.prop("disabled", true).text($t({defaultMessage: "Working…"}));
|
||||
const opts = {
|
||||
success_continuation() {
|
||||
update_view_on_deactivate(row);
|
||||
},
|
||||
error_continuation() {
|
||||
row_deactivate_button.text(i18n.t("Deactivate"));
|
||||
row_deactivate_button.text($t({defaultMessage: "Deactivate"}));
|
||||
},
|
||||
};
|
||||
const url = "/json/users/" + encodeURIComponent(user_id);
|
||||
|
||||
@@ -4,7 +4,7 @@ import Plotly from "plotly.js/lib/core";
|
||||
import PlotlyPie from "plotly.js/lib/pie";
|
||||
import tippy from "tippy.js";
|
||||
|
||||
import {$t_html, i18n} from "../i18n";
|
||||
import {$t, $t_html} from "../i18n";
|
||||
import {page_params} from "../page_params";
|
||||
|
||||
Plotly.register([PlotlyBar, PlotlyPie]);
|
||||
@@ -42,18 +42,18 @@ function floor_to_local_week(date) {
|
||||
|
||||
function format_date(date, include_hour) {
|
||||
const months = [
|
||||
i18n.t("January"),
|
||||
i18n.t("February"),
|
||||
i18n.t("March"),
|
||||
i18n.t("April"),
|
||||
i18n.t("May"),
|
||||
i18n.t("June"),
|
||||
i18n.t("July"),
|
||||
i18n.t("August"),
|
||||
i18n.t("September"),
|
||||
i18n.t("October"),
|
||||
i18n.t("November"),
|
||||
i18n.t("December"),
|
||||
$t({defaultMessage: "January"}),
|
||||
$t({defaultMessage: "February"}),
|
||||
$t({defaultMessage: "March"}),
|
||||
$t({defaultMessage: "April"}),
|
||||
$t({defaultMessage: "May"}),
|
||||
$t({defaultMessage: "June"}),
|
||||
$t({defaultMessage: "July"}),
|
||||
$t({defaultMessage: "August"}),
|
||||
$t({defaultMessage: "September"}),
|
||||
$t({defaultMessage: "October"}),
|
||||
$t({defaultMessage: "November"}),
|
||||
$t({defaultMessage: "December"}),
|
||||
];
|
||||
const month_str = months[date.getMonth()];
|
||||
const year = date.getFullYear();
|
||||
@@ -111,20 +111,20 @@ function populate_messages_sent_over_time(data) {
|
||||
return {
|
||||
human: {
|
||||
// 5062a0
|
||||
name: i18n.t("Humans"),
|
||||
name: $t({defaultMessage: "Humans"}),
|
||||
y: values.human,
|
||||
marker: {color: "#5f6ea0"},
|
||||
...common,
|
||||
},
|
||||
bot: {
|
||||
// a09b5f bbb56e
|
||||
name: i18n.t("Bots"),
|
||||
name: $t({defaultMessage: "Bots"}),
|
||||
y: values.bot,
|
||||
marker: {color: "#b7b867"},
|
||||
...common,
|
||||
},
|
||||
me: {
|
||||
name: i18n.t("Me"),
|
||||
name: $t({defaultMessage: "Me"}),
|
||||
y: values.me,
|
||||
marker: {color: "#be6d68"},
|
||||
...common,
|
||||
@@ -159,7 +159,7 @@ function populate_messages_sent_over_time(data) {
|
||||
buttons: [
|
||||
{stepmode: "backward", ...button1},
|
||||
{stepmode: "backward", ...button2},
|
||||
{step: "all", label: i18n.t("All time")},
|
||||
{step: "all", label: $t({defaultMessage: "All time"})},
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -168,14 +168,14 @@ function populate_messages_sent_over_time(data) {
|
||||
const daily_rangeselector = make_rangeselector(
|
||||
0.68,
|
||||
-0.62,
|
||||
{count: 10, label: i18n.t("Last 10 days"), step: "day"},
|
||||
{count: 30, label: i18n.t("Last 30 days"), step: "day"},
|
||||
{count: 10, label: $t({defaultMessage: "Last 10 days"}), step: "day"},
|
||||
{count: 30, label: $t({defaultMessage: "Last 30 days"}), step: "day"},
|
||||
);
|
||||
const weekly_rangeselector = make_rangeselector(
|
||||
0.656,
|
||||
-0.62,
|
||||
{count: 2, label: i18n.t("Last 2 months"), step: "month"},
|
||||
{count: 6, label: i18n.t("Last 6 months"), step: "month"},
|
||||
{count: 2, label: $t({defaultMessage: "Last 2 months"}), step: "month"},
|
||||
{count: 6, label: $t({defaultMessage: "Last 6 months"}), step: "month"},
|
||||
);
|
||||
|
||||
function add_hover_handler() {
|
||||
@@ -273,7 +273,7 @@ function populate_messages_sent_over_time(data) {
|
||||
|
||||
info = aggregate_data("week");
|
||||
date_formatter = function (date) {
|
||||
return i18n.t("Week of __date__", {date: format_date(date, false)});
|
||||
return $t({defaultMessage: "Week of {date}"}, {date: format_date(date, false)});
|
||||
};
|
||||
const last_week_is_partial = info.last_value_is_partial;
|
||||
const weekly_traces = make_traces(info.dates, info.values, "bar", date_formatter);
|
||||
@@ -702,9 +702,19 @@ function populate_number_of_users(data) {
|
||||
x: 0.64,
|
||||
y: -0.79,
|
||||
buttons: [
|
||||
{count: 2, label: i18n.t("Last 2 months"), step: "month", stepmode: "backward"},
|
||||
{count: 6, label: i18n.t("Last 6 months"), step: "month", stepmode: "backward"},
|
||||
{step: "all", label: i18n.t("All time")},
|
||||
{
|
||||
count: 2,
|
||||
label: $t({defaultMessage: "Last 2 months"}),
|
||||
step: "month",
|
||||
stepmode: "backward",
|
||||
},
|
||||
{
|
||||
count: 6,
|
||||
label: $t({defaultMessage: "Last 6 months"}),
|
||||
step: "month",
|
||||
stepmode: "backward",
|
||||
},
|
||||
{step: "all", label: $t({defaultMessage: "All time"})},
|
||||
],
|
||||
},
|
||||
},
|
||||
@@ -721,7 +731,7 @@ function populate_number_of_users(data) {
|
||||
x: end_dates,
|
||||
y: values,
|
||||
type,
|
||||
name: i18n.t("Active users"),
|
||||
name: $t({defaultMessage: "Active users"}),
|
||||
hoverinfo: "none",
|
||||
text,
|
||||
visible: true,
|
||||
@@ -801,13 +811,13 @@ function populate_messages_read_over_time(data) {
|
||||
const common = {x: dates, type, hoverinfo: "none", text};
|
||||
return {
|
||||
everyone: {
|
||||
name: i18n.t("Everyone"),
|
||||
name: $t({defaultMessage: "Everyone"}),
|
||||
y: values.everyone,
|
||||
marker: {color: "#5f6ea0"},
|
||||
...common,
|
||||
},
|
||||
me: {
|
||||
name: i18n.t("Me"),
|
||||
name: $t({defaultMessage: "Me"}),
|
||||
y: values.me,
|
||||
marker: {color: "#be6d68"},
|
||||
...common,
|
||||
@@ -842,7 +852,7 @@ function populate_messages_read_over_time(data) {
|
||||
buttons: [
|
||||
{stepmode: "backward", ...button1},
|
||||
{stepmode: "backward", ...button2},
|
||||
{step: "all", label: i18n.t("All time")},
|
||||
{step: "all", label: $t({defaultMessage: "All time"})},
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -851,14 +861,14 @@ function populate_messages_read_over_time(data) {
|
||||
const daily_rangeselector = make_rangeselector(
|
||||
0.68,
|
||||
-0.62,
|
||||
{count: 10, label: i18n.t("Last 10 days"), step: "day"},
|
||||
{count: 30, label: i18n.t("Last 30 days"), step: "day"},
|
||||
{count: 10, label: $t({defaultMessage: "Last 10 days"}), step: "day"},
|
||||
{count: 30, label: $t({defaultMessage: "Last 30 days"}), step: "day"},
|
||||
);
|
||||
const weekly_rangeselector = make_rangeselector(
|
||||
0.656,
|
||||
-0.62,
|
||||
{count: 2, label: i18n.t("Last 2 months"), step: "month"},
|
||||
{count: 6, label: i18n.t("Last 6 months"), step: "month"},
|
||||
{count: 2, label: $t({defaultMessage: "Last 2 months"}), step: "month"},
|
||||
{count: 6, label: $t({defaultMessage: "Last 6 months"}), step: "month"},
|
||||
);
|
||||
|
||||
function add_hover_handler() {
|
||||
@@ -949,7 +959,7 @@ function populate_messages_read_over_time(data) {
|
||||
|
||||
info = aggregate_data("week");
|
||||
date_formatter = function (date) {
|
||||
return i18n.t("Week of __date__", {date: format_date(date, false)});
|
||||
return $t({defaultMessage: "Week of {date}"}, {date: format_date(date, false)});
|
||||
};
|
||||
const last_week_is_partial = info.last_value_is_partial;
|
||||
const weekly_traces = make_traces(info.dates, info.values, "bar", date_formatter);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import * as color_class from "./color_class";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_view_header from "./message_view_header";
|
||||
import * as subs from "./subs";
|
||||
|
||||
@@ -122,7 +122,7 @@ export const sidebar_popover_colorpicker_options_full = {
|
||||
showInput: true,
|
||||
flat: true,
|
||||
cancelText: "",
|
||||
chooseText: i18n.t("Confirm"),
|
||||
chooseText: $t({defaultMessage: "Confirm"}),
|
||||
palette: stream_color_palette,
|
||||
change: picker_do_change_color,
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import render_subscription_invites_warning_modal from "../templates/subscription
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as loading from "./loading";
|
||||
import {page_params} from "./page_params";
|
||||
import * as peer_data from "./peer_data";
|
||||
@@ -33,16 +33,17 @@ export function get_name() {
|
||||
class StreamSubscriptionError {
|
||||
report_no_subs_to_stream() {
|
||||
$("#stream_subscription_error").text(
|
||||
i18n.t("You cannot create a stream with no subscribers!"),
|
||||
$t({defaultMessage: "You cannot create a stream with no subscribers!"}),
|
||||
);
|
||||
$("#stream_subscription_error").show();
|
||||
}
|
||||
|
||||
cant_create_stream_without_susbscribing() {
|
||||
$("#stream_subscription_error").text(
|
||||
i18n.t(
|
||||
$t({
|
||||
defaultMessage:
|
||||
"You must be an organization administrator to create a stream without subscribing.",
|
||||
),
|
||||
}),
|
||||
);
|
||||
$("#stream_subscription_error").show();
|
||||
}
|
||||
@@ -55,7 +56,9 @@ const stream_subscription_error = new StreamSubscriptionError();
|
||||
|
||||
class StreamNameError {
|
||||
report_already_exists() {
|
||||
$("#stream_name_error").text(i18n.t("A stream with this name already exists"));
|
||||
$("#stream_name_error").text(
|
||||
$t({defaultMessage: "A stream with this name already exists"}),
|
||||
);
|
||||
$("#stream_name_error").show();
|
||||
}
|
||||
|
||||
@@ -64,7 +67,7 @@ class StreamNameError {
|
||||
}
|
||||
|
||||
report_empty_stream() {
|
||||
$("#stream_name_error").text(i18n.t("A stream needs to have a name"));
|
||||
$("#stream_name_error").text($t({defaultMessage: "A stream needs to have a name"}));
|
||||
$("#stream_name_error").show();
|
||||
}
|
||||
|
||||
@@ -209,7 +212,9 @@ function create_stream() {
|
||||
const user_ids = get_principals();
|
||||
data.principals = JSON.stringify(user_ids);
|
||||
|
||||
loading.make_indicator($("#stream_creating_indicator"), {text: i18n.t("Creating stream...")});
|
||||
loading.make_indicator($("#stream_creating_indicator"), {
|
||||
text: $t({defaultMessage: "Creating stream..."}),
|
||||
});
|
||||
|
||||
// Subscribe yourself and possible other people to a new stream.
|
||||
return channel.post({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as color_data from "./color_data";
|
||||
import {FoldDict} from "./fold_dict";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import {page_params} from "./page_params";
|
||||
import * as peer_data from "./peer_data";
|
||||
import * as people from "./people";
|
||||
@@ -104,39 +104,42 @@ const default_stream_ids = new Set();
|
||||
export const stream_privacy_policy_values = {
|
||||
public: {
|
||||
code: "public",
|
||||
name: i18n.t("Public"),
|
||||
description: i18n.t(
|
||||
name: $t({defaultMessage: "Public"}),
|
||||
description: $t({
|
||||
defaultMessage:
|
||||
"Anyone can join; anyone can view complete message history without joining",
|
||||
),
|
||||
}),
|
||||
},
|
||||
private_with_public_history: {
|
||||
code: "invite-only-public-history",
|
||||
name: i18n.t("Private, shared history"),
|
||||
description: i18n.t(
|
||||
name: $t({defaultMessage: "Private, shared history"}),
|
||||
description: $t({
|
||||
defaultMessage:
|
||||
"Must be invited by a member; new members can view complete message history; hidden from non-administrator users",
|
||||
),
|
||||
}),
|
||||
},
|
||||
private: {
|
||||
code: "invite-only",
|
||||
name: i18n.t("Private, protected history"),
|
||||
description: i18n.t(
|
||||
name: $t({defaultMessage: "Private, protected history"}),
|
||||
description: $t({
|
||||
defaultMessage:
|
||||
"Must be invited by a member; new members can only see messages sent after they join; hidden from non-administrator users",
|
||||
),
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
export const stream_post_policy_values = {
|
||||
everyone: {
|
||||
code: 1,
|
||||
description: i18n.t("All stream members can post"),
|
||||
description: $t({defaultMessage: "All stream members can post"}),
|
||||
},
|
||||
admins: {
|
||||
code: 2,
|
||||
description: i18n.t("Only organization administrators can post"),
|
||||
description: $t({defaultMessage: "Only organization administrators can post"}),
|
||||
},
|
||||
non_new_members: {
|
||||
code: 3,
|
||||
description: i18n.t("Only organization full members can post"),
|
||||
description: $t({defaultMessage: "Only organization full members can post"}),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as browser_history from "./browser_history";
|
||||
import * as channel from "./channel";
|
||||
import * as confirm_dialog from "./confirm_dialog";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as input_pill from "./input_pill";
|
||||
import * as ListWidget from "./list_widget";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
@@ -101,7 +101,7 @@ export function get_retention_policy_text_for_subscription_type(sub) {
|
||||
|
||||
// Forever for this stream, overriding the organization default
|
||||
if (sub.message_retention_days === settings_config.retain_message_forever) {
|
||||
return i18n.t("Messages in this stream will be retained forever.");
|
||||
return $t({defaultMessage: "Messages in this stream will be retained forever."});
|
||||
}
|
||||
|
||||
// If we are deleting messages, even if it's the organization
|
||||
@@ -110,8 +110,11 @@ export function get_retention_policy_text_for_subscription_type(sub) {
|
||||
message_retention_days = page_params.realm_message_retention_days;
|
||||
}
|
||||
|
||||
return i18n.t(
|
||||
"Messages in this stream will be automatically deleted after __retention_days__ days.",
|
||||
return $t(
|
||||
{
|
||||
defaultMessage:
|
||||
"Messages in this stream will be automatically deleted after {retention_days} days.",
|
||||
},
|
||||
{retention_days: message_retention_days},
|
||||
);
|
||||
}
|
||||
@@ -119,11 +122,12 @@ export function get_retention_policy_text_for_subscription_type(sub) {
|
||||
export function get_display_text_for_realm_message_retention_setting() {
|
||||
const realm_message_retention_days = page_params.realm_message_retention_days;
|
||||
if (realm_message_retention_days === settings_config.retain_message_forever) {
|
||||
return i18n.t("(forever)");
|
||||
return $t({defaultMessage: "(forever)"});
|
||||
}
|
||||
return i18n.t("(__message_retention_days__ days)", {
|
||||
message_retention_days: realm_message_retention_days,
|
||||
});
|
||||
return $t(
|
||||
{defaultMessage: "({message_retention_days} days)"},
|
||||
{message_retention_days: realm_message_retention_days},
|
||||
);
|
||||
}
|
||||
|
||||
function change_stream_message_retention_days_block_display_property(value) {
|
||||
@@ -248,7 +252,7 @@ function submit_add_subscriber_form(e) {
|
||||
}
|
||||
if (user_ids.size === 0) {
|
||||
stream_subscription_info_elem
|
||||
.text(i18n.t("No user to subscribe."))
|
||||
.text($t({defaultMessage: "No user to subscribe."}))
|
||||
.addClass("text-error")
|
||||
.removeClass("text-success");
|
||||
return;
|
||||
@@ -607,7 +611,7 @@ function change_stream_privacy(e) {
|
||||
},
|
||||
error(xhr) {
|
||||
ui_report.error($t_html({defaultMessage: "Failed"}), xhr, stream_privacy_status);
|
||||
$("#change-stream-privacy-button").text(i18n.t("Try again"));
|
||||
$("#change-stream-privacy-button").text($t({defaultMessage: "Try again"}));
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -808,17 +812,21 @@ export function initialize() {
|
||||
if (data.removed.length > 0) {
|
||||
// Remove the user from the subscriber list.
|
||||
list_entry.remove();
|
||||
stream_subscription_info_elem.text(i18n.t("Unsubscribed successfully!"));
|
||||
stream_subscription_info_elem.text(
|
||||
$t({defaultMessage: "Unsubscribed successfully!"}),
|
||||
);
|
||||
// The rest of the work is done via the subscription -> remove event we will get
|
||||
} else {
|
||||
stream_subscription_info_elem.text(i18n.t("User is already not subscribed."));
|
||||
stream_subscription_info_elem.text(
|
||||
$t({defaultMessage: "User is already not subscribed."}),
|
||||
);
|
||||
}
|
||||
stream_subscription_info_elem.addClass("text-success").removeClass("text-error");
|
||||
}
|
||||
|
||||
function removal_failure() {
|
||||
stream_subscription_info_elem
|
||||
.text(i18n.t("Error removing user from this stream."))
|
||||
.text($t({defaultMessage: "Error removing user from this stream."}))
|
||||
.addClass("text-error")
|
||||
.removeClass("text-success");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import $ from "jquery";
|
||||
|
||||
import render_subscription_type from "../templates/subscription_type.hbs";
|
||||
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as ListWidget from "./list_widget";
|
||||
import {page_params} from "./page_params";
|
||||
import * as peer_data from "./peer_data";
|
||||
@@ -46,7 +46,7 @@ export function initialize_cant_subscribe_popover(sub) {
|
||||
button_wrapper,
|
||||
settings_button,
|
||||
settings_button,
|
||||
i18n.t("Only stream members can add users to a private stream"),
|
||||
$t({defaultMessage: "Only stream members can add users to a private stream"}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ export function update_settings_button_for_sub(sub) {
|
||||
// This is for the Subscribe/Unsubscribe button in the right panel.
|
||||
const settings_button = subs.settings_button_for_sub(sub);
|
||||
if (sub.subscribed) {
|
||||
settings_button.text(i18n.t("Unsubscribe")).removeClass("unsubscribed");
|
||||
settings_button.text($t({defaultMessage: "Unsubscribe"})).removeClass("unsubscribed");
|
||||
} else {
|
||||
settings_button.text(i18n.t("Subscribe")).addClass("unsubscribed");
|
||||
settings_button.text($t({defaultMessage: "Subscribe"})).addClass("unsubscribed");
|
||||
}
|
||||
if (stream_data.can_toggle_subscription(sub)) {
|
||||
settings_button.prop("disabled", false);
|
||||
@@ -209,7 +209,7 @@ export function update_add_subscriptions_elements(sub) {
|
||||
$(".add_subscribers_container"),
|
||||
input_element,
|
||||
button_element,
|
||||
i18n.t("Only stream members can add users to a private stream"),
|
||||
$t({defaultMessage: "Only stream members can add users to a private stream"}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import * as components from "./components";
|
||||
import * as compose_state from "./compose_state";
|
||||
import * as confirm_dialog from "./confirm_dialog";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {$t_html, i18n} from "./i18n";
|
||||
import {$t, $t_html} from "./i18n";
|
||||
import * as loading from "./loading";
|
||||
import * as message_live_update from "./message_live_update";
|
||||
import * as message_view_header from "./message_view_header";
|
||||
@@ -565,20 +565,20 @@ export function setup_page(callback) {
|
||||
const sort_toggler = components.toggle({
|
||||
values: [
|
||||
{
|
||||
label_html: `<i class="fa fa-sort-alpha-asc tippy-bottom tippy-zulip-tooltip" data-tippy-content="${i18n.t(
|
||||
"Sort by name",
|
||||
label_html: `<i class="fa fa-sort-alpha-asc tippy-bottom tippy-zulip-tooltip" data-tippy-content="${$t(
|
||||
{defaultMessage: "Sort by name"},
|
||||
)}"></i>`,
|
||||
key: "by-stream-name",
|
||||
},
|
||||
{
|
||||
label_html: `<i class="fa fa-user-o tippy-bottom tippy-zulip-tooltip" data-tippy-content="${i18n.t(
|
||||
"Sort by number of subscribers",
|
||||
label_html: `<i class="fa fa-user-o tippy-bottom tippy-zulip-tooltip" data-tippy-content="${$t(
|
||||
{defaultMessage: "Sort by number of subscribers"},
|
||||
)}"></i>`,
|
||||
key: "by-subscriber-count",
|
||||
},
|
||||
{
|
||||
label_html: `<i class="fa fa-bar-chart tippy-bottom tippy-zulip-tooltip" data-tippy-content="${i18n.t(
|
||||
"Sort by estimated weekly traffic",
|
||||
label_html: `<i class="fa fa-bar-chart tippy-bottom tippy-zulip-tooltip" data-tippy-content="${$t(
|
||||
{defaultMessage: "Sort by estimated weekly traffic"},
|
||||
)}"></i>`,
|
||||
key: "by-weekly-traffic",
|
||||
},
|
||||
@@ -601,8 +601,8 @@ export function setup_page(callback) {
|
||||
toggler = components.toggle({
|
||||
child_wants_focus: true,
|
||||
values: [
|
||||
{label: i18n.t("Subscribed"), key: "subscribed"},
|
||||
{label: i18n.t("All streams"), key: "all-streams"},
|
||||
{label: $t({defaultMessage: "Subscribed"}), key: "subscribed"},
|
||||
{label: $t({defaultMessage: "All streams"}), key: "all-streams"},
|
||||
],
|
||||
callback(value, key) {
|
||||
switch_stream_tab(key);
|
||||
@@ -668,7 +668,7 @@ export function setup_page(callback) {
|
||||
populate_and_fill();
|
||||
|
||||
if (!should_list_all_streams()) {
|
||||
$(".create_stream_button").val(i18n.t("Subscribe"));
|
||||
$(".create_stream_button").val($t({defaultMessage: "Subscribe"}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import $ from "jquery";
|
||||
import _ from "lodash";
|
||||
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import {page_params} from "./page_params";
|
||||
|
||||
let next_timerender_id = 0;
|
||||
@@ -45,10 +45,10 @@ export function render_now(time, today = new Date()) {
|
||||
const days_old = differenceInCalendarDays(today, time);
|
||||
|
||||
if (days_old === 0) {
|
||||
time_str = i18n.t("Today");
|
||||
time_str = $t({defaultMessage: "Today"});
|
||||
needs_update = true;
|
||||
} else if (days_old === 1) {
|
||||
time_str = i18n.t("Yesterday");
|
||||
time_str = $t({defaultMessage: "Yesterday"});
|
||||
needs_update = true;
|
||||
} else if (time.getFullYear() !== today.getFullYear()) {
|
||||
// For long running servers, searching backlog can get ambiguous
|
||||
@@ -72,10 +72,10 @@ export function render_now(time, today = new Date()) {
|
||||
export function last_seen_status_from_date(last_active_date, current_date = new Date()) {
|
||||
const minutes = differenceInMinutes(current_date, last_active_date);
|
||||
if (minutes <= 2) {
|
||||
return i18n.t("Just now");
|
||||
return $t({defaultMessage: "Just now"});
|
||||
}
|
||||
if (minutes < 60) {
|
||||
return i18n.t("__minutes__ minutes ago", {minutes});
|
||||
return $t({defaultMessage: "{minutes} minutes ago"}, {minutes});
|
||||
}
|
||||
|
||||
const days_old = differenceInCalendarDays(current_date, last_active_date);
|
||||
@@ -83,30 +83,32 @@ export function last_seen_status_from_date(last_active_date, current_date = new
|
||||
|
||||
if (days_old === 0) {
|
||||
if (hours === 1) {
|
||||
return i18n.t("An hour ago");
|
||||
return $t({defaultMessage: "An hour ago"});
|
||||
}
|
||||
return i18n.t("__hours__ hours ago", {hours});
|
||||
return $t({defaultMessage: "{hours} hours ago"}, {hours});
|
||||
}
|
||||
|
||||
if (days_old === 1) {
|
||||
return i18n.t("Yesterday");
|
||||
return $t({defaultMessage: "Yesterday"});
|
||||
}
|
||||
|
||||
if (days_old < 90) {
|
||||
return i18n.t("__days_old__ days ago", {days_old});
|
||||
return $t({defaultMessage: "{days_old} days ago"}, {days_old});
|
||||
} else if (
|
||||
days_old > 90 &&
|
||||
days_old < 365 &&
|
||||
last_active_date.getFullYear() === current_date.getFullYear()
|
||||
) {
|
||||
// Online more than 90 days ago, in the same year
|
||||
return i18n.t("__last_active_date__", {
|
||||
last_active_date: format(last_active_date, "MMM\u00A0dd"),
|
||||
});
|
||||
return $t(
|
||||
{defaultMessage: "{last_active_date}"},
|
||||
{last_active_date: format(last_active_date, "MMM\u00A0dd")},
|
||||
);
|
||||
}
|
||||
return i18n.t("__last_active_date__", {
|
||||
last_active_date: format(last_active_date, "MMM\u00A0dd,\u00A0yyyy"),
|
||||
});
|
||||
return $t(
|
||||
{defaultMessage: "{last_active_date}"},
|
||||
{last_active_date: format(last_active_date, "MMM\u00A0dd,\u00A0yyyy")},
|
||||
);
|
||||
}
|
||||
|
||||
// List of the dates that need to be updated when the day changes.
|
||||
|
||||
@@ -4,7 +4,7 @@ import render_widgets_todo_widget from "../templates/widgets/todo_widget.hbs";
|
||||
import render_widgets_todo_widget_tasks from "../templates/widgets/todo_widget_tasks.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
|
||||
export class TaskData {
|
||||
task_map = new Map();
|
||||
@@ -149,7 +149,7 @@ export function activate(opts) {
|
||||
|
||||
const task_exists = task_data.name_in_use(task);
|
||||
if (task_exists) {
|
||||
elem.find(".widget-error").text(i18n.t("Task already exists"));
|
||||
elem.find(".widget-error").text($t({defaultMessage: "Task already exists"}));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import SimpleBar from "simplebar/dist/simplebar";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as common from "./common";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import {localstorage} from "./localstorage";
|
||||
import * as message_list from "./message_list";
|
||||
import * as message_lists from "./message_lists";
|
||||
@@ -81,10 +81,13 @@ export function update_starred_view(message_id, new_value) {
|
||||
elt.removeClass("fa-star").addClass("fa-star-o");
|
||||
star_container.addClass("empty-star");
|
||||
}
|
||||
const title_state = starred ? i18n.t("Unstar") : i18n.t("Star");
|
||||
const title_state = starred ? $t({defaultMessage: "Unstar"}) : $t({defaultMessage: "Star"});
|
||||
elt.attr(
|
||||
"title",
|
||||
i18n.t("__starred_status__ this message (Ctrl + s)", {starred_status: title_state}),
|
||||
$t(
|
||||
{defaultMessage: "{starred_status} this message (Ctrl + s)"},
|
||||
{starred_status: title_state},
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -106,8 +109,11 @@ export function show_failed_message_success(message_id) {
|
||||
}
|
||||
|
||||
export function get_hotkey_deprecation_notice(originalHotkey, replacementHotkey) {
|
||||
return i18n.t(
|
||||
'We\'ve replaced the "__originalHotkey__" hotkey with "__replacementHotkey__" to make this common shortcut easier to trigger.',
|
||||
return $t(
|
||||
{
|
||||
defaultMessage:
|
||||
'We\'ve replaced the "{originalHotkey}" hotkey with "{replacementHotkey}" to make this common shortcut easier to trigger.',
|
||||
},
|
||||
{originalHotkey, replacementHotkey},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import $ from "jquery";
|
||||
import _ from "lodash";
|
||||
|
||||
import * as common from "./common";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
|
||||
/* Arguments used in the report_* functions are,
|
||||
response- response that we want to display
|
||||
@@ -65,7 +65,7 @@ export function generic_row_button_error(xhr, btn) {
|
||||
$("<p>").addClass("text-error").text(JSON.parse(xhr.responseText).msg),
|
||||
);
|
||||
} else {
|
||||
btn.text(i18n.t("Failed!"));
|
||||
btn.text($t({defaultMessage: "Failed!"}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as compose_actions from "./compose_actions";
|
||||
import * as compose_state from "./compose_state";
|
||||
import * as compose_ui from "./compose_ui";
|
||||
import {csrf_token} from "./csrf";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import {page_params} from "./page_params";
|
||||
|
||||
export function make_upload_absolute(uri) {
|
||||
@@ -27,7 +27,7 @@ export function feature_check(upload_button) {
|
||||
}
|
||||
|
||||
export function get_translated_status(file) {
|
||||
const status = i18n.t("Uploading __filename__…", {filename: file.name});
|
||||
const status = $t({defaultMessage: "Uploading {filename}…"}, {filename: file.name});
|
||||
return "[" + status + "]()";
|
||||
}
|
||||
|
||||
@@ -102,7 +102,10 @@ export function hide_upload_status(config) {
|
||||
get_item("send_status", config).removeClass("alert-info").hide();
|
||||
}
|
||||
|
||||
export function show_error_message(config, message = i18n.t("An unknown error occurred.")) {
|
||||
export function show_error_message(
|
||||
config,
|
||||
message = $t({defaultMessage: "An unknown error occurred."}),
|
||||
) {
|
||||
get_item("send_button", config).prop("disabled", false);
|
||||
get_item("send_status", config).addClass("alert-error").removeClass("alert-info").show();
|
||||
get_item("send_status_message", config).text(message);
|
||||
@@ -115,7 +118,9 @@ export function upload_files(uppy, config, files) {
|
||||
if (page_params.max_file_upload_size_mib === 0) {
|
||||
show_error_message(
|
||||
config,
|
||||
i18n.t("File and image uploads have been disabled for this organization."),
|
||||
$t({
|
||||
defaultMessage: "File and image uploads have been disabled for this organization.",
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -133,7 +138,7 @@ export function upload_files(uppy, config, files) {
|
||||
|
||||
get_item("send_button", config).prop("disabled", true);
|
||||
get_item("send_status", config).addClass("alert-info").removeClass("alert-error").show();
|
||||
get_item("send_status_message", config).html($("<p>").text(i18n.t("Uploading…")));
|
||||
get_item("send_status_message", config).html($("<p>").text($t({defaultMessage: "Uploading…"})));
|
||||
get_item("send_status_close_button", config).one("click", () => {
|
||||
for (const file of uppy.getFiles()) {
|
||||
compose_ui.replace_syntax(
|
||||
@@ -179,8 +184,8 @@ export function setup_upload(config) {
|
||||
},
|
||||
locale: {
|
||||
strings: {
|
||||
exceedsSize: i18n.t("This file exceeds maximum allowed size of"),
|
||||
failedToUpload: i18n.t("Failed to upload %{file}"),
|
||||
exceedsSize: $t({defaultMessage: "This file exceeds maximum allowed size of"}),
|
||||
failedToUpload: $t({defaultMessage: "Failed to upload %'{file}'"}),
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -195,7 +200,9 @@ export function setup_upload(config) {
|
||||
limit: 5,
|
||||
locale: {
|
||||
strings: {
|
||||
timedOut: i18n.t("Upload stalled for %{seconds} seconds, aborting."),
|
||||
timedOut: $t({
|
||||
defaultMessage: "Upload stalled for %'{seconds}' seconds, aborting.",
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
|
||||
const default_max_file_size = 5;
|
||||
|
||||
@@ -76,21 +76,22 @@ export function build_widget(
|
||||
const file = e.target.files[0];
|
||||
if (file.size > max_file_upload_size * 1024 * 1024) {
|
||||
input_error.text(
|
||||
i18n.t("File size must be < __max_file_size__Mb.", {
|
||||
max_file_size: max_file_upload_size,
|
||||
}),
|
||||
$t(
|
||||
{defaultMessage: "File size must be < {max_file_size}Mb."},
|
||||
{max_file_size: max_file_upload_size},
|
||||
),
|
||||
);
|
||||
input_error.show();
|
||||
clear();
|
||||
} else if (!is_image_format(file)) {
|
||||
input_error.text(i18n.t("File type is not supported."));
|
||||
input_error.text($t({defaultMessage: "File type is not supported."}));
|
||||
input_error.show();
|
||||
clear();
|
||||
} else {
|
||||
accept(file);
|
||||
}
|
||||
} else {
|
||||
input_error.text(i18n.t("Please just upload one file."));
|
||||
input_error.text($t({defaultMessage: "Please just upload one file."}));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,21 +165,22 @@ export function build_direct_upload_widget(
|
||||
const file = e.target.files[0];
|
||||
if (file.size > max_file_upload_size * 1024 * 1024) {
|
||||
input_error.text(
|
||||
i18n.t("File size must be < __max_file_size__Mb.", {
|
||||
max_file_size: max_file_upload_size,
|
||||
}),
|
||||
$t(
|
||||
{defaultMessage: "File size must be < {max_file_size}Mb."},
|
||||
{max_file_size: max_file_upload_size},
|
||||
),
|
||||
);
|
||||
input_error.show();
|
||||
clear();
|
||||
} else if (!is_image_format(file)) {
|
||||
input_error.text(i18n.t("File type is not supported."));
|
||||
input_error.text($t({defaultMessage: "File type is not supported."}));
|
||||
input_error.show();
|
||||
clear();
|
||||
} else {
|
||||
accept();
|
||||
}
|
||||
} else {
|
||||
input_error.text(i18n.t("Please just upload one file."));
|
||||
input_error.text($t({defaultMessage: "Please just upload one file."}));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as browser_history from "./browser_history";
|
||||
import * as channel from "./channel";
|
||||
import * as common from "./common";
|
||||
import * as feedback_widget from "./feedback_widget";
|
||||
import {i18n} from "./i18n";
|
||||
import {$t} from "./i18n";
|
||||
import * as night_mode from "./night_mode";
|
||||
import * as scroll_bar from "./scroll_bar";
|
||||
|
||||
@@ -75,8 +75,8 @@ export function enter_day_mode() {
|
||||
command: "/night",
|
||||
});
|
||||
},
|
||||
title_text: i18n.t("Day mode"),
|
||||
undo_button_text: i18n.t("Night"),
|
||||
title_text: $t({defaultMessage: "Day mode"}),
|
||||
undo_button_text: $t({defaultMessage: "Night"}),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -97,8 +97,8 @@ export function enter_night_mode() {
|
||||
command: "/day",
|
||||
});
|
||||
},
|
||||
title_text: i18n.t("Night mode"),
|
||||
undo_button_text: i18n.t("Day"),
|
||||
title_text: $t({defaultMessage: "Night mode"}),
|
||||
undo_button_text: $t({defaultMessage: "Day"}),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -119,8 +119,8 @@ export function enter_fluid_mode() {
|
||||
command: "/fixed-width",
|
||||
});
|
||||
},
|
||||
title_text: i18n.t("Fluid width mode"),
|
||||
undo_button_text: i18n.t("Fixed width"),
|
||||
title_text: $t({defaultMessage: "Fluid width mode"}),
|
||||
undo_button_text: $t({defaultMessage: "Fixed width"}),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -141,8 +141,8 @@ export function enter_fixed_mode() {
|
||||
command: "/fluid-width",
|
||||
});
|
||||
},
|
||||
title_text: i18n.t("Fixed width mode"),
|
||||
undo_button_text: i18n.t("Fluid width"),
|
||||
title_text: $t({defaultMessage: "Fixed width mode"}),
|
||||
undo_button_text: $t({defaultMessage: "Fluid width"}),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user