mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
compose_ui: Use Intl.ListFormat rather than .join(", ").
This commit changes .join(",") to Int1.ListFormat.
This produces more accurate translations.
Refactor compose_ui.test to update the testcase for Alice and Bob.
The previous test case output of "Alice,Bob" modify to "Alice and Bob"
to align with the behavior of Int1.ListFormat,
which joins lists using ',' & 'and'.
This commit is contained in:
@@ -247,20 +247,20 @@ run_test("compute_placeholder_text", () => {
|
||||
opts.private_message_recipient = "alice@zulip.com,bob@zulip.com";
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message Alice, Bob"}),
|
||||
$t({defaultMessage: "Message Alice and Bob"}),
|
||||
);
|
||||
|
||||
alice.is_guest = true;
|
||||
page_params.realm_enable_guest_user_indicator = true;
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message translated: Alice (guest), Bob"}),
|
||||
$t({defaultMessage: "Message translated: Alice (guest) and Bob"}),
|
||||
);
|
||||
|
||||
page_params.realm_enable_guest_user_indicator = false;
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message Alice, Bob"}),
|
||||
$t({defaultMessage: "Message Alice and Bob"}),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user