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:
Pranav Raj S 2020-05-06 13:38:36 +05:30 committed by GitHub
parent d6d15c8c3c
commit c7120e9637
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 473 additions and 250 deletions

View file

@ -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