diff --git a/lib/post_creator.rb b/lib/post_creator.rb index 5bac660899b..7c19f663ce4 100644 --- a/lib/post_creator.rb +++ b/lib/post_creator.rb @@ -351,7 +351,8 @@ class PostCreator :closed, true, Discourse.system_user, message: I18n.t( 'topic_statuses.autoclosed_message_max_posts', - count: SiteSetting.auto_close_messages_post_count + count: SiteSetting.auto_close_messages_post_count, + locale: SiteSetting.default_locale ) ) elsif !is_private_message && @@ -363,7 +364,8 @@ class PostCreator :closed, true, Discourse.system_user, message: I18n.t( 'topic_statuses.autoclosed_topic_max_posts', - count: SiteSetting.auto_close_topics_post_count + count: SiteSetting.auto_close_topics_post_count, + locale: SiteSetting.default_locale ) ) end diff --git a/spec/components/post_creator_spec.rb b/spec/components/post_creator_spec.rb index 2838e86072e..b5616e81900 100644 --- a/spec/components/post_creator_spec.rb +++ b/spec/components/post_creator_spec.rb @@ -391,6 +391,26 @@ describe PostCreator do expect(topic.closed).to eq(true) expect(topic_timer.reload.deleted_at).to eq_time(Time.zone.now) end + + it "uses the system locale for the message" do + post + + I18n.with_locale(:fr) do + PostCreator.new( + topic.user, + topic_id: topic.id, + raw: "this is a second post" + ).create + end + + topic.reload + + expect(topic.posts.last.raw).to eq(I18n.t( + 'topic_statuses.autoclosed_topic_max_posts', + count: SiteSetting.auto_close_topics_post_count, + locale: :en + )) + end end end end