Change Foundation text direction in RTL languages
This way, when the language is written form right-to-left, elements using Foundation mixins/classes will float to the opposite direction as they do in left-to-right languages. The same will apply to text alignment. To offer full support for RTL languages, we need to change every single reference to `float: left`, `float: right`, `text-align: left`, `text-align: right`, and possible adjust other properties like `left`, `margin-left`, `padding-left` or `border-left`. In the meantime, we at least partially support these languages. Replacing `float` with `flex` when possible would also improve RTL support.
This commit is contained in:
3
app/assets/stylesheets/application-rtl.scss
Normal file
3
app/assets/stylesheets/application-rtl.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
$global-text-direction: rtl;
|
||||
|
||||
@import "application";
|
||||
@@ -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?
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title><%= content_for?(:title) ? yield(:title) : default_title %></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" %>
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user