1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-10 00:46:15 +01:00
fab-manager/lib/sidekiq/server_locale.rb

15 lines
335 B
Ruby
Raw Normal View History

2023-03-22 17:30:37 +01:00
# frozen_string_literal: true
# module definition
module FabManager::Middleware; end
# Provides localization in workers
class FabManager::Middleware::ServerLocale
def call(_worker_class, job, _queue)
locale = job['locale'] || Rails.application.secrets.rails_locale
I18n.with_locale(locale) do
yield
2022-07-25 15:13:28 +02:00
end
end
2023-03-22 17:30:37 +01:00
end