Rtlplugin

agatronic edited this page Jun 3, 2012 · 2 revisions

RTL Plugin

For creating stylesheets for LTR and RTL languages.

The idea behind this plugin is to help authors where they want the look of the site to change when displaying in a RTL language. When changing the direction in html, the order of inline elements is reversed, but floated elements still float the same direction and margins stay the same, so it is common to want to reverse some properties.

The plugin looks at directional properties (optionally prefixed in a special way) and treats these differently. For example,

.myRule {
    float: left;
    -rtl-margin-left: 3px;
}

will be rendered as

.myRule {
    float: left;
}

in LTR and

.myRule {
    float: right;
    margin-left: 3px;
}

in RTL.

The plugin works in 2 ways, explicit and implicit, controlled by the "onlyReversePrefixedRules" parameter. If the parameter is true then only rules prefixed with -ltr-reverse- and -rtl-reverse- will be reversed. If the parameter is false then left,right,margin,border,padding,float will be reversed.

Prefixing the rule with just -rtl- or -ltr- will make the rule only apply to that specific direction.

Whether you are RTL or LTR is determined by 1. If the current culture of thread is a RTL language then it is RTL, otherwise it is LTR. 2. using the ForceRtlTransform parameter, this forces the plugin into RTL mode.