UX: Moderator post wasn't completely translatable

This commit is contained in:
Gerhard Schlager 2019-02-20 16:37:32 +01:00
parent 04a63cfaaa
commit 66901f67f6
3 changed files with 25 additions and 6 deletions

View File

@ -196,12 +196,12 @@ class PostMover
def create_moderator_post_in_original_topic
move_type_str = PostMover.move_types[@move_type].to_s
move_type_str.sub!("topic", "message") if @move_to_pm
message = I18n.with_locale(SiteSetting.default_locale) do
I18n.t(
"move_posts.#{move_type_str}_moderator_post",
count: posts.length,
entity: @move_to_pm ? "message" : "topic",
topic_link: posts.first.is_first_post? ?
"[#{destination_topic.title}](#{destination_topic.relative_url})" :
"[#{destination_topic.title}](#{posts.first.url})"

View File

@ -2038,11 +2038,17 @@ en:
move_posts:
new_topic_moderator_post:
one: "A post was split to a new %{entity}: %{topic_link}"
other: "%{count} posts were split to a new %{entity}: %{topic_link}"
one: "A post was split to a new topic: %{topic_link}"
other: "%{count} posts were split to a new topic: %{topic_link}"
new_message_moderator_post:
one: "A post was split to a new message: %{topic_link}"
other: "%{count} posts were split to a new message: %{topic_link}"
existing_topic_moderator_post:
one: "A post was merged into an existing %{entity}: %{topic_link}"
other: "%{count} posts were merged into an existing %{entity}: %{topic_link}"
one: "A post was merged into an existing topic: %{topic_link}"
other: "%{count} posts were merged into an existing topic: %{topic_link}"
existing_message_moderator_post:
one: "A post was merged into an existing message: %{topic_link}"
other: "%{count} posts were merged into an existing message: %{topic_link}"
change_owner:
post_revision_text: "Ownership transferred"

View File

@ -248,7 +248,6 @@ describe PostMover do
expected_text = I18n.with_locale(:en) do
I18n.t("move_posts.new_topic_moderator_post",
count: 2,
entity: "topic",
topic_link: "[#{new_topic.title}](#{new_topic.relative_url})")
end
@ -660,6 +659,20 @@ describe PostMover do
expect(personal_message.closed).to eq(true)
expect(moved_to.posts_count).to eq(6)
end
it "uses the correct small action post" do
moved_to = personal_message.move_posts(admin, [p2.id], destination_topic_id: another_personal_message.id, archetype: "private_message")
post = Post.find_by(topic_id: personal_message.id, post_type: Post.types[:small_action])
expected_text = I18n.t(
"move_posts.existing_message_moderator_post",
count: 1,
topic_link: "[#{moved_to.title}](#{p2.reload.url})",
locale: :en
)
expect(post.raw).to eq(expected_text)
end
end
end
end