[FIX] mail: allow accurate translation by providing full context

closes odoo/odoo#116195

Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
This commit is contained in:
Louis Wicket (wil)
2023-03-22 14:52:44 +01:00
parent 02cdb9f754
commit 10716e4837
2 changed files with 21 additions and 11 deletions
+20
View File
@@ -8,6 +8,7 @@ import { Composer } from "../composer/composer";
import { Activity } from "@mail/web/activity/activity";
import {
Component,
markup,
onMounted,
onPatched,
onWillStart,
@@ -24,6 +25,7 @@ import { useAttachmentUploader } from "@mail/attachments/attachment_uploader_hoo
import { useHover, useScrollPosition } from "@mail/utils/hooks";
import { FollowerSubtypeDialog } from "./follower_subtype_dialog";
import { _t } from "@web/core/l10n/translation";
import { escape, sprintf } from "@web/core/utils/strings";
import { SuggestedRecipientsList } from "./suggested_recipient_list";
/**
@@ -177,6 +179,24 @@ export class Chatter extends Component {
return this.state.thread?.attachments ?? [];
}
/**
* @returns {string}
*/
get toFollowersText() {
const threadName = this.state.thread.displayName || this.state.thread.name;
const toFollowersText = threadName
? sprintf(
_t(
'<span class="fw-bold">To:</span> <span class="fst-italic">Followers of</span> <span class="fw-bold">"%(thread name)s"</span>.'
),
{ "thread name": escape(threadName) }
)
: _t(
'<span class="fw-bold">To:</span> <span class="fst-italic">Followers of</span> this document.'
);
return markup(toFollowersText);
}
/**
* @param {number} threadId
* @param {['activities'|'followers'|'attachments'|'messages'|'suggestedRecipients']} requestList
+1 -11
View File
@@ -74,17 +74,7 @@
</div>
<t t-if="state.thread.composer.type">
<t t-if="state.thread.composer.type === 'message'">
<div class="flex-shrink-0 px-3 pt-3 text-truncate small" style="margin-left:48px;">
<span class="fw-bold">To:</span> <span class="fst-italic">Followers of</span>
<b class="px-1">
<t t-if="state.thread.displayName or state.thread.name">
"<t t-out="state.thread.displayName or state.thread.name"/>"
</t>
<t t-else="">
this document
</t>
</b>
</div>
<div class="flex-shrink-0 px-3 pt-3 text-truncate small" style="margin-left:48px" t-out="toFollowersText"/>
</t>
<t t-if="state.thread.composer.type === 'message'" t-set="placeholder">Send a message to followers...</t>
<t t-else="" t-set="placeholder">Log an internal note...</t>