[FIX] mail: adjusts member list separator to the locale

Prior to this commit, the separator used to separate the names of the
members of a group DM could not be translated. This is because the
string being translated is too short to be considered by the translation
system.

This commit fixes the problem by no longer relying on the Odoo
translation system and instead using the ECMAScript Internationalization
API.

closes odoo/odoo#118306

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Louis Wicket (wil)
2023-04-13 04:08:45 +02:00
parent 7bd2be754e
commit c16bef413f
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -214,9 +214,13 @@ export class Thread {
);
}
if (this.type === "group" && !this.name) {
return this.channelMembers
.map((channelMember) => channelMember.persona.name)
.join(_t(", "));
const listFormatter = new Intl.ListFormat(
this._store.env.services["user"].lang.replace("_", "-"),
{ type: "conjunction", style: "long" }
);
return listFormatter.format(
this.channelMembers.map((channelMember) => channelMember.persona.name)
);
}
return this.name;
}
@@ -111,6 +111,6 @@ QUnit.test("should be able to create a new group chat from an existing chat", as
await click("button[title='Create Group Chat']");
assert.strictEqual(
$(".o-mail-Discuss-threadName").val(),
"Mitchell Admin, TestPartner, TestPartner2"
"Mitchell Admin, TestPartner, and TestPartner2"
);
});