diff --git a/app/assets/stylesheets/application-rtl.scss b/app/assets/stylesheets/application-rtl.scss
new file mode 100644
index 000000000..99d12603a
--- /dev/null
+++ b/app/assets/stylesheets/application-rtl.scss
@@ -0,0 +1,3 @@
+$global-text-direction: rtl;
+
+@import "application";
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index b14baa148..e57d06576 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -6,6 +6,10 @@ module ApplicationHelper
url_for(request.query_parameters.merge(query_parameters).merge(only_path: true))
end
+ def rtl?
+ %i[ar fa he].include?(I18n.locale)
+ end
+
def markdown(text)
return text if text.blank?
diff --git a/app/views/layouts/_common_head.html.erb b/app/views/layouts/_common_head.html.erb
index d4c0d4daf..abed78d19 100644
--- a/app/views/layouts/_common_head.html.erb
+++ b/app/views/layouts/_common_head.html.erb
@@ -2,7 +2,11 @@
<%= content_for?(:title) ? yield(:title) : default_title %>
-<%= stylesheet_link_tag "application" %>
+<% if rtl? %>
+ <%= stylesheet_link_tag "application-rtl" %>
+<% else %>
+ <%= stylesheet_link_tag "application" %>
+<% end %>
<%= javascript_include_tag "application", "data-turbolinks-track" => "reload" %>
<%= csrf_meta_tags %>
<%= favicon_link_tag "favicon.ico" %>
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb
index 8c3176b12..1a78ad60a 100644
--- a/app/views/layouts/admin.html.erb
+++ b/app/views/layouts/admin.html.erb
@@ -1,5 +1,5 @@
-
+ lang="<%= I18n.locale %>">
<%= render "layouts/common_head", default_title: "Admin" %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 68a067c6d..18bc7f78c 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,5 +1,5 @@
-
+ lang="<%= I18n.locale %>" data-current-user-id="<%= current_user&.id %>">
<%= render "layouts/common_head", default_title: setting["org_name"] %>
<%= render "layouts/tracking_data" %>
diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb
index cf6753750..c781d4403 100644
--- a/app/views/layouts/devise.html.erb
+++ b/app/views/layouts/devise.html.erb
@@ -1,5 +1,5 @@
-
+ lang="<%= I18n.locale %>">
<%= render "layouts/common_head", default_title: setting["org_name"] %>
<%= render "layouts/meta_tags" %>
diff --git a/app/views/layouts/management.html.erb b/app/views/layouts/management.html.erb
index 1d427044c..efd92bbdb 100644
--- a/app/views/layouts/management.html.erb
+++ b/app/views/layouts/management.html.erb
@@ -1,5 +1,5 @@
-
+ lang="<%= I18n.locale %>">
<%= render "layouts/common_head", default_title: "Management" %>
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 1afb578ff..6630e63f6 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -12,6 +12,7 @@ Rails.application.config.assets.version = "1.0"
Rails.application.config.assets.precompile += %w[ckeditor/config.js]
Rails.application.config.assets.precompile += %w[stat_graphs.js]
Rails.application.config.assets.precompile += %w[dashboard_graphs.js]
+Rails.application.config.assets.precompile += %w[application-rtl.css]
Rails.application.config.assets.precompile += %w[print.css]
Rails.application.config.assets.precompile += %w[pdf_fonts.css]
Rails.application.config.assets.precompile += %w[sdg/*.png]