48
RTL on Y!FP RIGHT-TO-LEFT ON THE YAHOO! FRONT PAGE

RTL on Y!FP

  • Upload
    walter

  • View
    48

  • Download
    0

Embed Size (px)

DESCRIPTION

RTL on Y!FP. Right-to-left on the Yahoo! Front page. Chris Klaiber. [email protected] Front page SNV A2. The Yahoo! US front page. Right-to-left on Yahoo! Maktoob. RTL, or right-to-left, is a reading direction. BiDi , or bidirectional, is text with both directionalities. - PowerPoint PPT Presentation

Citation preview

Page 1: RTL on Y!FP

RTL on Y!FPRIGHT-TO-LEFT ON THE YAHOO! FRONT PAGE

Page 2: RTL on Y!FP

Chris [email protected]

FRONT PAGE

SNV A2

Page 3: RTL on Y!FP

The Yahoo! US front page

Page 4: RTL on Y!FP

Right-to-left on Yahoo! Maktoob

Page 5: RTL on Y!FP

RTL, or right-to-left,is a reading direction

BiDi, or bidirectional,is text with both directionalities

Page 6: RTL on Y!FP

Bidirectional website

One codebase,two text directions

Page 7: RTL on Y!FP

Top 10 Languagesin the Internet

Page 8: RTL on Y!FP
Page 9: RTL on Y!FP
Page 10: RTL on Y!FP

Yahoo! Products Operating Principles

#10. Build for global reach with local flexibility

Page 11: RTL on Y!FP

1. Awareness of RTL and BiDi2. Why BiDi is important to Yahoo!3. How to build BiDi web sites

What to take with you

Page 12: RTL on Y!FP

The Yahoo! US front page

Page 13: RTL on Y!FP

Right-to-left on Yahoo! Maktoob

Page 14: RTL on Y!FP

Left-to-right scrollbar

Page 15: RTL on Y!FP

Scrollbar orientation changes

Page 16: RTL on Y!FP

Let’s dive in

Page 17: RTL on Y!FP

RTLification: The end goal

Page 18: RTL on Y!FP

STEP 1: Localize strings

Page 19: RTL on Y!FP

Always use Unicode

Page 20: RTL on Y!FP

STEP 2: Text direction

?

Page 21: RTL on Y!FP

HTML DIR attribute

dir = LTR | RTL

Specifies the base direction of text for an element and the directionality of tables. Default value is LTR.

<h3 dir=“rtl”>The 6 most delicious hamburgers</h3>

Page 22: RTL on Y!FP

CSS direction and unicode-bidi

direction: ltr | rtl | inherit

Specifies the base direction of text for an element and the directionality of tables. Default value is ltr.

<h3 style=“direction: rtl; unicode-bidi: embed”>The 6 most delicious hamburgers</h3>

unicode-bidi: normal | embed | bidi-override | inherit

Gives some control over the Unicode bidirectional algorithm for text. Default value is normal.

Page 23: RTL on Y!FP

Apply dir=“rtl” to root

Page 24: RTL on Y!FP

DIR cannot fix CSS

Page 25: RTL on Y!FP

<table dir=“ltr”>

<table dir=“rtl”>

DIR can also flip tables

Page 26: RTL on Y!FP

STEP 3: Flip CSS horizontally

padding: 0 0 2px 10px;padding-left: 11px;

float: left;

background-position: left 8px;background-image: sprite_ltr.png;

border-right-width: 1px;

Page 27: RTL on Y!FP

CSS: padding, margin, float

Page 28: RTL on Y!FP

CSS: background-image, border

Page 29: RTL on Y!FP

All together: Strings, HTML, CSS

Page 30: RTL on Y!FP

CSSJanus

A CSS processor that horizontally flips properties and values

http://code.google.com/p/cssjanus/

http://dist.corp.yahoo.com/css_janus/

Page 31: RTL on Y!FP

Flip CSS automatically

.sample-cssjanus-targets { background-position: top 23%; border-left-color: chartreuse; cursor: e-resize; float: right; left: 10px; margin-right: 2em; padding: 0.25em 15px 0pt 0ex;}

Page 32: RTL on Y!FP

@noflip/* @noflip */.leave-me-alone { padding-left: 1em; float: left;}

.mostly-applicable { padding-left: 1em; /* @noflip */ float: left; margin-left: 1em;}

Page 33: RTL on Y!FP

Swap URLs

./cssjanus.py --swap_ltr_rtl_in_url

.image { background-image: url(image_ltr.png);}

.image { background-image: url(image_rtl.png);}

Page 34: RTL on Y!FP

.edit-sprite { background-position: left -1054px; background-image: url(/i/ww/met/th/slate/sprite_pg_slate_20100809_ltr.png);

padding-left: 16px;}

<button class=“edit-sprite”> Edit</button>

Page 35: RTL on Y!FP

RTLzr(by Yahoo’s Marcel Duran)

A Firefox plugin that flips page direction

https://addons.mozilla.org/en-us/firefox/addon/rtlzr/

Page 36: RTL on Y!FP

A quick demo

Page 37: RTL on Y!FP

Tricks, bugs, and other subtleties

Page 38: RTL on Y!FP

• One generic CSS source• Build RTLifies CSS to CDN• Serve a parallel CSS hierarchy

metro/g/masthead/masthead_0.2.115.cssmetro/xa/masthead/masthead_0.2.115.css

Front page CSSJanus integration

Page 39: RTL on Y!FP

The Unicode bidirectional algorithmcomposes runs of LTR, RTL text.

Think of strings containing “Yahoo!”

Page 40: RTL on Y!FP

2 31

23 1

Left-to-right mark &lrm; is necessary to control neutral “!”

Page 41: RTL on Y!FP

Otherwise “!” joins the RTL text

2 31

23 1

Page 42: RTL on Y!FP

&lrm; is convenient.Markup is recommended.

2 31

23 1

Page 43: RTL on Y!FP

<ul style="float:right"> <li style="float:right"> Content </li></ul>

<ul dir="rtl" style="float:right"> <li style="float:right"> Content </li></ul>

Nested right float:RTL-specific IE6 bug

Page 44: RTL on Y!FP

<ul dir="rtl" style="float:right; width:150px"> <li style="float:right"> Content </li></ul>

Nested right float:The width fix

Page 45: RTL on Y!FP

<ul dir="rtl" style="float:right;width:100%"> <li style="float:right;width:100%"> <ul style="float:right;width:100%"> <li style="float:right"> Content </li> </ul> </li></ul>

Nested right float:Width fix failure

Page 46: RTL on Y!FP

<style type="text/css">.inner-block { display: inline-block; }.ua-ie6 .inner-block { display: inline; zoom: 1;}</style>

<ul dir="rtl" style="float:right"> <li class="inner-block"> Content </li></ul>

Nested right float:An alternative

Page 47: RTL on Y!FP

Thank You!Slides available on FE Summit web page

Page 48: RTL on Y!FP

Internal Resourceshttp://twiki.corp.yahoo.com/view/FrontDoors/MetroFrontEndRTLhttp://twiki.corp.yahoo.com/view/TrailBlazers/BidiGuidelineshttp://twiki.corp.yahoo.com/view/Frontpage/MaktoobQAhttp://twiki.corp.yahoo.com/view/Ued/BidiBestPractices

Toolshttp://labs.javascriptrules.com/rtlzr/http://cssjanus.commoner.com/http://dist.corp.yahoo.com/by-package/css_janus

External Resourceshttp://www.unicode.org/reports/tr9/http://www.i18nguy.com/markup/right-to-left.htmhttp://www.iamcal.com/understanding-bidirectional-text/http://www.alanflavell.org.uk/charset/text-direction.html