mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
message_edit: Fix internationalization of edited notices.
The previous internationalization approach didn't support languages with a different word order than English. We also switch to using "moved" to explain topic/stream moves, consistent with how the message feed explains it.
This commit is contained in:
@@ -35,23 +35,34 @@ export function fetch_and_render_message_history(message) {
|
|||||||
show_date_row: prev_time === null || !isSameDay(time, prev_time),
|
show_date_row: prev_time === null || !isSameDay(time, prev_time),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (msg.user_id) {
|
if (!msg.user_id) {
|
||||||
const person = people.get_by_user_id(msg.user_id);
|
continue;
|
||||||
item.edited_by = person.full_name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const person = people.get_by_user_id(msg.user_id);
|
||||||
|
const full_name = person.full_name;
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
item.posted_or_edited = $t({defaultMessage: "Posted by"});
|
item.edited_by_notice = $t(
|
||||||
|
{defaultMessage: "Posted by {full_name}"},
|
||||||
|
{full_name},
|
||||||
|
);
|
||||||
item.body_to_render = msg.rendered_content;
|
item.body_to_render = msg.rendered_content;
|
||||||
} else if (msg.prev_topic && msg.prev_content) {
|
} else if (msg.prev_topic && msg.prev_content) {
|
||||||
item.posted_or_edited = $t({defaultMessage: "Edited by"});
|
item.edited_by_notice = $t(
|
||||||
|
{defaultMessage: "Edited by {full_name}"},
|
||||||
|
{full_name},
|
||||||
|
);
|
||||||
item.body_to_render = msg.content_html_diff;
|
item.body_to_render = msg.content_html_diff;
|
||||||
item.topic_edited = true;
|
item.topic_edited = true;
|
||||||
item.prev_topic = msg.prev_topic;
|
item.prev_topic = msg.prev_topic;
|
||||||
item.new_topic = msg.topic;
|
item.new_topic = msg.topic;
|
||||||
} else if (msg.prev_topic && msg.prev_stream) {
|
} else if (msg.prev_topic && msg.prev_stream) {
|
||||||
const sub = sub_store.get(msg.prev_stream);
|
const sub = sub_store.get(msg.prev_stream);
|
||||||
item.posted_or_edited = $t({defaultMessage: "Edited by"});
|
item.edited_by_notice = $t(
|
||||||
|
{defaultMessage: "Moved by {full_name}"},
|
||||||
|
{full_name},
|
||||||
|
);
|
||||||
item.topic_edited = true;
|
item.topic_edited = true;
|
||||||
item.prev_topic = msg.prev_topic;
|
item.prev_topic = msg.prev_topic;
|
||||||
item.new_topic = msg.topic;
|
item.new_topic = msg.topic;
|
||||||
@@ -68,13 +79,19 @@ export function fetch_and_render_message_history(message) {
|
|||||||
}
|
}
|
||||||
prev_stream_item = item;
|
prev_stream_item = item;
|
||||||
} else if (msg.prev_topic) {
|
} else if (msg.prev_topic) {
|
||||||
item.posted_or_edited = $t({defaultMessage: "Topic edited by"});
|
item.edited_by_notice = $t(
|
||||||
|
{defaultMessage: "Moved by {full_name}"},
|
||||||
|
{full_name},
|
||||||
|
);
|
||||||
item.topic_edited = true;
|
item.topic_edited = true;
|
||||||
item.prev_topic = msg.prev_topic;
|
item.prev_topic = msg.prev_topic;
|
||||||
item.new_topic = msg.topic;
|
item.new_topic = msg.topic;
|
||||||
} else if (msg.prev_stream) {
|
} else if (msg.prev_stream) {
|
||||||
const sub = sub_store.get(msg.prev_stream);
|
const sub = sub_store.get(msg.prev_stream);
|
||||||
item.posted_or_edited = $t({defaultMessage: "Stream edited by"});
|
item.edited_by_notice = $t(
|
||||||
|
{defaultMessage: "Moved by {full_name}"},
|
||||||
|
{full_name},
|
||||||
|
);
|
||||||
item.stream_changed = true;
|
item.stream_changed = true;
|
||||||
if (!sub) {
|
if (!sub) {
|
||||||
item.prev_stream = $t({defaultMessage: "Unknown stream"});
|
item.prev_stream = $t({defaultMessage: "Unknown stream"});
|
||||||
@@ -89,7 +106,10 @@ export function fetch_and_render_message_history(message) {
|
|||||||
prev_stream_item = item;
|
prev_stream_item = item;
|
||||||
} else {
|
} else {
|
||||||
// just a content edit
|
// just a content edit
|
||||||
item.posted_or_edited = $t({defaultMessage: "Edited by"});
|
item.edited_by_notice = $t(
|
||||||
|
{defaultMessage: "Edited by {full_name}"},
|
||||||
|
{full_name},
|
||||||
|
);
|
||||||
item.body_to_render = msg.content_html_diff;
|
item.body_to_render = msg.content_html_diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
{{#if body_to_render}}
|
{{#if body_to_render}}
|
||||||
<div class="message_content rendered_markdown message_edit_history_content">{{rendered_markdown body_to_render}}</div>
|
<div class="message_content rendered_markdown message_edit_history_content">{{rendered_markdown body_to_render}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="message_author"><div class="author_details">{{ posted_or_edited }} {{ edited_by }}</div></div>
|
<div class="message_author"><div class="author_details">{{ edited_by_notice }}</div></div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|||||||
Reference in New Issue
Block a user