Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed May 29, 2018
1 parent 122ef07 commit 82087aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/lib/y2packager/widgets/product_license_translations.rb
Expand Up @@ -115,7 +115,8 @@ def content_language
# @return [String] Language code
def default_language
candidate_lang = Yast::Stage.initial ? Yast::Language.preselected : language
return candidate_lang if product.license_locales.include?(candidate_lang)
translated = product.license_locales.any? { |l| candidate_lang.start_with?(l) }
return candidate_lang if translated
DEFAULT_FALLBACK_LANGUAGE
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/lib/widgets/product_license_translations_test.rb
Expand Up @@ -24,7 +24,7 @@

let(:language) { "de_DE" }
let(:product) do
instance_double(Y2Packager::Product, license_locales: ["en_US", "es_ES"], license: "content")
instance_double(Y2Packager::Product, license_locales: ["en_US", "ja"], license: "content")
end

describe "#contents" do
Expand All @@ -41,7 +41,7 @@
end

context "when running on textmode" do
let(:preselected) { "es_ES" }
let(:preselected) { "ja_JP" }

before do
allow(Yast::UI).to receive(:TextMode).and_return(true)
Expand Down Expand Up @@ -83,7 +83,7 @@

context "on the installed system" do
let(:initial) { false }
let(:language) { "es_ES" }
let(:language) { "ja_JP" }

it "the language selector includes only the default language" do
expect(Y2Packager::Widgets::SimpleLanguageSelection).to receive(:new)
Expand Down

0 comments on commit 82087aa

Please sign in to comment.