File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
app/services/discourse_translator Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 33module DiscourseTranslator
44 class PostTranslator
55 def self . translate ( post , target_locale = I18n . locale )
6- return if post . blank? || target_locale . blank?
6+ return if post . blank? || target_locale . blank? || post . locale == target_locale . to_s
77
88 target_locale_sym = target_locale . to_s . sub ( "-" , "_" ) . to_sym
99
Original file line number Diff line number Diff line change 2222 expect ( described_class . translate ( post , "" ) ) . to eq ( nil )
2323 end
2424
25+ it "returns nil if target_locale is same as post locale" do
26+ post . locale = "en"
27+
28+ expect ( described_class . translate ( post , "en" ) ) . to eq ( nil )
29+ end
30+
2531 it "translates with post and locale" do
2632 translator . expects ( :translate_post! ) . with ( post , :ja ) . returns ( translated_raw )
2733
You can’t perform that action at this time.
0 commit comments