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 #6409

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions less/alerts.less
Expand Up @@ -8,6 +8,9 @@

.alert {
padding: 8px 35px 8px 14px;
.rtl & {
padding: 8px 14px 8px 35px;
}
margin-bottom: @baseLineHeight;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
background-color: @warningBackground;
Expand All @@ -28,6 +31,10 @@
position: relative;
top: -2px;
right: -21px;
.rtl & {
left: -21px;
right: auto;
}
line-height: @baseLineHeight;
}

Expand Down
3 changes: 3 additions & 0 deletions less/close.less
Expand Up @@ -17,6 +17,9 @@
cursor: pointer;
.opacity(40);
}
.rtl & {
float: left;
}
}

// Additional properties for button version
Expand Down
3 changes: 3 additions & 0 deletions less/code.less
Expand Up @@ -11,6 +11,9 @@ pre {
font-size: @baseFontSize - 2;
color: @grayDark;
.border-radius(3px);
.rtl & {
direction: ltr;
}
}

// Inline code
Expand Down
65 changes: 65 additions & 0 deletions less/mixins.less
Expand Up @@ -60,11 +60,19 @@

&:first-child {
*margin-left: 0;
.rtl & {
*margin-left: auto;
*margin-right: 0;
}
}
}

.ie7-restore-right-whitespace() {
*margin-right: .3em;
.rtl & {
*margin-left: .3em;
*margin-right: auto;
}
}

// Sizing shortcuts
Expand Down Expand Up @@ -538,17 +546,30 @@
float: none; // undo default grid column styles
width: ((@gridColumnWidth) * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1)) - 16; // 16 is total padding on left and right of table cells
margin-left: 0; // undo default grid column styles
.rtl & {
margin-left: auto;
margin-right: 0;
}
}

// Make a Grid
// Use .makeRow and .makeColumn to assign semantic layouts grid system behavior
.makeRow() {
margin-left: @gridGutterWidth * -1;
.rtl & {
margin-left: auto;
margin-right: @gridGutterWidth * -1;
}
.clearfix();
}
.makeColumn(@columns: 1, @offset: 0) {
float: left;
margin-left: (@gridColumnWidth * @offset) + (@gridGutterWidth * (@offset - 1)) + (@gridGutterWidth * 2);
.rtl & {
float: right;
margin-left: auto;
margin-right: (@gridColumnWidth * @offset) + (@gridGutterWidth * (@offset - 1)) + (@gridGutterWidth * 2);
}
width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
}

Expand All @@ -571,6 +592,10 @@

.offset (@columns) {
margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns + 1));
.rtl & {
margin-left: auto;
margin-right: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns + 1));
}
}

.span (@columns) {
Expand All @@ -579,13 +604,22 @@

.row {
margin-left: @gridGutterWidth * -1;
.rtl & {
margin-left: auto;
margin-right: @gridGutterWidth * -1;
}
.clearfix();
}

[class*="span"] {
float: left;
min-height: 1px; // prevent collapsing columns
margin-left: @gridGutterWidth;
.rtl & {
float: right;
margin-left: auto;
margin-right: @gridGutterWidth;
}
}

// Set the container width, and override it for fixed navbars in media queries
Expand Down Expand Up @@ -618,11 +652,23 @@
.offset (@columns) {
margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth*2);
*margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + (@fluidGridGutterWidth*2) - (.5 / @gridRowWidth * 100 * 1%);
.rtl & {
margin-left: auto;
*margin-left: auto;
margin-right: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth*2);
*margin-right: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + (@fluidGridGutterWidth*2) - (.5 / @gridRowWidth * 100 * 1%);
}
}

.offsetFirstChild (@columns) {
margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth);
*margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%);
.rtl & {
margin-left: auto;
*margin-left: auto;
margin-right: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth);
*margin-right: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%);
}
}

.span (@columns) {
Expand All @@ -638,14 +684,29 @@
float: left;
margin-left: @fluidGridGutterWidth;
*margin-left: @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%);
.rtl & {
float: right;
margin-left: auto;
*margin-left: auto;
margin-right: @fluidGridGutterWidth;
*margin-right: @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%);
}
}
[class*="span"]:first-child {
margin-left: 0;
.rtl & {
margin-left: auto;
margin-right: 0;
}
}

// Space grid-sized controls properly if multiple per line
.controls-row [class*="span"] + [class*="span"] {
margin-left: @fluidGridGutterWidth;
.rtl & {
margin-left: auto;
margin-right: @fluidGridGutterWidth;
}
}

// generate .spanX and .offsetX
Expand Down Expand Up @@ -676,6 +737,10 @@
// Space grid-sized controls properly if multiple per line
.controls-row [class*="span"] + [class*="span"] {
margin-left: @gridGutterWidth;
.rtl & {
margin-left: auto;
margin-right: @gridGutterWidth;
}
}

// generate .spanX
Expand Down
4 changes: 4 additions & 0 deletions less/scaffolding.less
Expand Up @@ -13,8 +13,12 @@ body {
line-height: @baseLineHeight;
color: @textColor;
background-color: @bodyBackground;
direction: ltr;
}

.rtl {
direction: rtl;
}

// Links
// -------------------------
Expand Down