Skip to content

Instantly share code, notes, and snippets.

@thomasleese
Created July 2, 2018 10:22
Show Gist options
  • Select an option

  • Save thomasleese/036a57017e8dac4d78bfb73cd025b581 to your computer and use it in GitHub Desktop.

Select an option

Save thomasleese/036a57017e8dac4d78bfb73cd025b581 to your computer and use it in GitHub Desktop.
n = I18n.available_locales.length
threads = []
1000.times do |i|
loc = I18n.available_locales[i % n]
threads << Thread.new do
sleep rand(0.1...1.0)
I18n.with_locale(loc) do
sleep rand(0.1...1.0)
puts "#{loc} #{I18n.locale} #{I18n.t 'document.type.announcement.one'}"
raise "mismatch" unless loc == I18n.locale
end
end
end
threads.each { |t| t.join }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment