This repository has been archived on 2023-03-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
osr-discourse-src/lib/rtl.rb
T
2017-07-03 15:26:57 -04:00

30 lines
459 B
Ruby

class Rtl
attr_reader :user
def initialize(user)
@user = user
end
def enabled?
site_locale_rtl? || current_user_rtl?
end
def current_user_rtl?
SiteSetting.allow_user_locale && user.try(:locale).in?(rtl_locales)
end
def site_locale_rtl?
!SiteSetting.allow_user_locale && SiteSetting.default_locale.in?(rtl_locales)
end
def rtl_locales
%w(he ar ur fa_IR)
end
def css_class
enabled? ? 'rtl' : ''
end
end