Chore: Add translated languages to account settings (#826)
* Add available languages in account settings Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
parent
d6d15c8c3c
commit
c7120e9637
37 changed files with 473 additions and 250 deletions
|
@ -24,9 +24,14 @@ class ApplicationController < ActionController::Base
|
|||
elsif @resource&.is_a?(AgentBot)
|
||||
account_accessible_for_bot?(account)
|
||||
end
|
||||
switch_locale account
|
||||
account
|
||||
end
|
||||
|
||||
def switch_locale(account)
|
||||
I18n.locale = (I18n.available_locales.map(&:to_s).include?(account.locale) ? account.locale : nil) || I18n.default_locale
|
||||
end
|
||||
|
||||
def account_accessible_for_user?(account)
|
||||
render_unauthorized('You are not authorized to access this account') unless account.account_users.find_by(user_id: current_user.id)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue