DEV: Remove duplicate definition of RTL locales and add Uyghur to the list (#27387)

This commit is contained in:
Gerhard Schlager 2024-06-08 21:24:39 +02:00 committed by GitHub
parent c13f64d35b
commit 1fbc1cd326
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 7 deletions

View File

@ -259,7 +259,7 @@ module ApplicationHelper
end
def rtl?
%w[ar ur fa_IR he].include? I18n.locale.to_s
Rtl::LOCALES.include? I18n.locale.to_s
end
def html_lang

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true
class Rtl
LOCALES = %w[ar fa_IR he ug ur]
attr_reader :user
def initialize(user)
@ -12,15 +14,11 @@ class Rtl
end
def current_user_rtl?
SiteSetting.allow_user_locale && (user&.locale || SiteSetting.default_locale).in?(rtl_locales)
SiteSetting.allow_user_locale && (user&.locale || SiteSetting.default_locale).in?(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]
!SiteSetting.allow_user_locale && SiteSetting.default_locale.in?(LOCALES)
end
def css_class