mirror of https://github.com/zulip/zulip.git
filter: Use Intl.ListFormat rather than .join(", ").
This commit is contained in:
parent
cd91bc3d71
commit
caa2dbbba4
|
@ -976,11 +976,7 @@ export class Filter {
|
|||
}
|
||||
return person.full_name;
|
||||
});
|
||||
|
||||
// We use join to handle the addition of a comma and space after every name
|
||||
// and also to ensure that we return a string and not an array so that we
|
||||
// can have the same return type as other cases.
|
||||
return names.join(", ");
|
||||
return util.format_array_as_list(names, "long", "conjunction");
|
||||
}
|
||||
if (term_types.length === 1 && _.isEqual(term_types, ["sender"])) {
|
||||
const email = this.operands("sender")[0];
|
||||
|
|
|
@ -1495,7 +1495,11 @@ test("navbar_helpers", () => {
|
|||
|
||||
// make sure title has names separated with correct delimiters
|
||||
function properly_separated_names(names) {
|
||||
return names.join(", ");
|
||||
const names_internationalized = new Intl.ListFormat("en", {
|
||||
style: "long",
|
||||
type: "conjunction",
|
||||
}).format(names);
|
||||
return names_internationalized;
|
||||
}
|
||||
|
||||
function test_redirect_url_with_search(test_case) {
|
||||
|
@ -1709,7 +1713,7 @@ test("navbar_helpers", () => {
|
|||
terms: dm_group_including_guest,
|
||||
is_common_narrow: true,
|
||||
icon: "envelope",
|
||||
title: "translated: alice (guest), joe",
|
||||
title: "translated: alice (guest) and joe",
|
||||
redirect_url_with_search: "/#narrow/dm/" + joe.user_id + "," + alice.user_id + "-group",
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue