Skip to content

Commit

Permalink
clean up the locale helper implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhooper committed Oct 22, 2024
1 parent e289f24 commit 1fd39b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/helpers/locale_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ def with_user_locale(user, &block)

if I18n.locale_available?(locale)
if defined?(url_options)
current_locale = I18n.locale
I18n.with_locale(locale) do
url_options_locale = url_options[:locale]
url_options[:locale] = locale
block.call
url_options[:locale] = current_locale
ensure
url_options[:locale] = url_options_locale
end
else
I18n.with_locale(locale, &block)
Expand Down

0 comments on commit 1fd39b7

Please sign in to comment.