Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RTL (right to left) support to 3.0.0-wip #6423

Closed
wants to merge 1 commit into from
Closed

Add RTL (right to left) support to 3.0.0-wip #6423

wants to merge 1 commit into from

Conversation

malekpour
Copy link

As we discussed on pull request #6409, RTL added in a separate rtl.less file on branch 3.0.0-wip.
All components supported. The page rtl.html, loads Bootstrap documentation .mustache templates on the fly and renders RTL/LTR contents correctly without any modification.
Tested and worked with Chrome 23, FireFox 17 and IE10.

Developers can add RTL layout support to their current Bootstrap websites, simply by adding .rtl CSS class to any HTML element. e.g:

<body class="rtl">...</body>

or dynamically

function switchLayout() {
  $(document.body).toggleClass('rtl')
}

Another class, .mirror is useful to change direction of arrows and font icons. See its functionality in 'Icons by Glyphicons' section of the demo.

Online Demo (buttons on navigation bar added to compare RTL/LTR layouts, F2 [RTL/LTR] and F3 [Mirror/Normal] keys also works and when modal popup is visible only hot keys will work)

@mdo
Copy link
Member

mdo commented Jan 4, 2013

Thanks for this, but I still want to see this with a component-by-component approach, not an all-in-one like this. Please pick one, single component and start with that first. The idea isn't to do all at once, but to figure out the guidelines of RTL, it's use, and best practices with a single component first, then expand that to the others.

Let's start small and take it from there.

@mdo mdo closed this Jan 4, 2013
@malekpour
Copy link
Author

You are welcome @mdo, but I can not understand your meaning by component-by-component. The rtl.less includes overridden styles for all components separated by comments. For example progress bar component just need the following code to support right to left.

.rtl .progress .bar {
  float: right;
}

So if any ancestor of a progress bar component has .rtl class, progress bar will become right to left, otherwise it will be left to right and this principle works for all Bootstrap components.

<!-- left to right -->
<div>
  <div class="progress">
    <div class="bar" style="width: 60%;"></div>
  </div>
</div>
<!-- right to left -->
<div class="rtl">
  <div class="progress">
    <div class="bar" style="width: 60%;"></div>
  </div>
</div>

I think this is very simple and a single paragraph instruction would help developers to use RTL support for all components.

@mdo
Copy link
Member

mdo commented Jan 4, 2013

I understand that you did all the components and docs here. What I'm saying is I'd like to see a single component first in an isolated pull request, and then do the others as we go.

@malekpour
Copy link
Author

Oh, I got it. Unfortunately I don't have time right now, to add items step by step by the time. If someone decide to work on RTL I always will be available for help.

@lanterndev
Copy link

Looks like @malekpour has put some time into this and reached his or her limit. In the meantime, it would be a shame for this work to languish. @mdo, if you don't want to merge this whole patch, could you just pull the parts of it that you want?

@cvrebert
Copy link
Collaborator

cvrebert commented Jul 8, 2013

X-Ref: #175

@cvrebert cvrebert mentioned this pull request Jul 9, 2013
@kharazi
Copy link

kharazi commented Aug 24, 2013

finally, how we can use RTL in bootstrap3? :D

@juthilo
Copy link
Collaborator

juthilo commented Aug 24, 2013

@kharazi core RTL support is currently planned, not guaranteed for version 3.1: #9397

@ggam ggam mentioned this pull request Sep 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants