Commit a516e929 authored by intrigeri's avatar intrigeri
Browse files

Merge branch 'test/9897-unsafe-browser-langs' into stable

Fix-committed: #9897
parents 4fd56700 a728286b
...@@ -5,25 +5,17 @@ When /^I see and accept the Unsafe Browser start verification$/ do ...@@ -5,25 +5,17 @@ When /^I see and accept the Unsafe Browser start verification$/ do
end end
def supported_torbrowser_languages def supported_torbrowser_languages
langs = Array.new localization_descriptions = "#{Dir.pwd}/config/chroot_local-includes/usr/share/tails/browser-localization/descriptions"
exts = @vm.execute_successfully( File.read(localization_descriptions).split("\n").map do |line|
"find /usr/local/share/tor-browser-extensions -maxdepth 1 -name 'langpack*.xpi' -printf \"%f\n\"").stdout # The line will be of the form "xx:YY:..." or "xx-YY:YY:..."
first, second = line.sub('-', '_').split(':')
# Some of the TBB languages are shipped with both a language and country code, e.g. es-ES. candidates = ["#{first}_#{second}.utf8", "#{first}.utf8",
# We'll only keep track of the language code and let `guess_best_tor_browser_locale` "#{first}_#{second}", first]
# try to get by with our approximated locales. when_not_found = Proc.new { raise "Could not find a locale for '#{line}'" }
supported_langs = exts.scan(/langpack-([a-z]+).*/).flatten candidates.find(when_not_found) do |candidate|
locales = @vm.execute_successfully( @vm.directory_exist?("/usr/lib/locale/#{candidate}")
"find /usr/lib/locale -maxdepth 1 -name '*.utf8' -printf \"%f\n\"").stdout.split end
# Determine a valid locale for each language that we want to test.
supported_langs.each do |lang|
# If a language shipped by TBB is not a supported system locale (e.g. 'vi'),
# 'find(nomatch)' will use the locale xx_XX for language 'xx'.
nomatch = proc { "#{lang}_#{lang.upcase}.utf8" }
langs << locales.find(nomatch) { |l| l.match(/^#{lang}/) }
end end
return langs
end end
Then /^I start the Unsafe Browser in the "([^"]+)" locale$/ do |loc| Then /^I start the Unsafe Browser in the "([^"]+)" locale$/ do |loc|
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment