diff --git a/app/models/miq_compare.rb b/app/models/miq_compare.rb index a2db004f13f..595a3917141 100644 --- a/app/models/miq_compare.rb +++ b/app/models/miq_compare.rb @@ -184,7 +184,7 @@ def section_header_text(model) when "VmOrTemplate" _("Workload") else - model.titleize + ui_lookup(:model => model) end end diff --git a/spec/models/miq_compare_spec.rb b/spec/models/miq_compare_spec.rb index 915cd4afe27..062c518fb44 100644 --- a/spec/models/miq_compare_spec.rb +++ b/spec/models/miq_compare_spec.rb @@ -29,4 +29,28 @@ expect { loaded = Marshal.load(dumped) }.not_to raise_error end end + + context "headers are translated" do + it "for EmsCluster" do + skip "Assumptions based on English message catalog" unless FastGettext.locale == "en" + + obj1 = FactoryBot.create(:ems_cluster) + obj2 = FactoryBot.create(:ems_cluster) + MiqReport.seed_report("clusters") + report = MiqReport.find_by(:title => "Cluster Compare Template") + compare = MiqCompare.new({:ids => [obj1.id, obj2.id]}, report) + expect(compare.master_list[0][:header]).to eq("Cluster") + end + + it "for Host" do + skip "Assumptions based on English message catalog" unless FastGettext.locale == "en" + + obj1 = FactoryBot.create(:host_vmware) + obj2 = FactoryBot.create(:host_vmware) + MiqReport.seed_report("hosts") + report = MiqReport.find_by(:name => "Hosts: Compare Template") + compare = MiqCompare.new({:ids => [obj1.id, obj2.id]}, report) + expect(compare.master_list[0][:header]).to eq("Host Properties") + end + end end