SlideShare a Scribd company logo
1 of 44
Download to read offline
Gmail BiDi Enabling - A Case Study from
           Two Perspectives


        Shoshannah Forbes, Shanjian Li




                                          1
Agenda


 ‣A quick recap of bidi
 ‣The challenge
 ‣The Goal
 ‣Layout issues
 ‣Truncation issues
 ‣Element order
 ‣Brackets
 ‣Bidirectional text editing
 ‣ Geresh & Gershayim

                               2

                                   2
A quick recap of bidi


      Short for “bidirectional”- text flows both from Right to Left (RTL)
       and Left to Right (LTR)




                                                                                                                                 3
I assume that the audience here knows what bidi is, however, to make sure we are all on the same page, a quick recap is needed
Types of directionality for characters




    ‣ Strong characters
    ‣ Weak characters
    ‣ Neutral characters




                                                                                       4

                                                                                           4
 Strong characters- they know their directionality
Weak characters- determine their directionality according to their proximity to other
characters with strong directionality Neutral characters- determine their directionality
from either the surrounding strong text or the embedding level
The challenge


  ‣Bidi : one of the most messy problems in I18n.
  ‣Many bidi issues not solved cleanly in the industry yet.
  ‣Browser Bidi supports are buggy, and each browser behaves
  differently.

  ‣Direction change impacts whole layout, brings up many layout
  issues.

  ‣GMail is a complicated, dynamic AJAX applications with restriction of
  browser capability.
   Mail display, composing etc, and those are not static pages.




                                                                           5

                                                                               5
The Goal




                                                                      5
                                                                      6

                                                                          6
Final goal- fully mirrored UI, mixing RTL and LTR elements and text
The goal- a closer look




                                                                                      7

                                                                                          7
Users tend to have mail both in English and in local language, so we need to be able to
handle both (for example, email from international sits like facebook or last.fm).
Although element order is RTL, many small details are LTR.
Note the mixed language labels (and the numbers next to them), bi-directional sender
names, and subject lines/snippets.
Note how although the order of the elements (sender, unread count, label, subject,
snippet) is rtl, each element can be either rtl or ltr.
Just plain flipping isn’t enough




                                                                                       8

                                                                                             8
You would think that setting dir=rtl to the body or html element will do the job. But look
what it caused here...
From an early build




                      9

                          9
More complex than seen at first glance


  ‣ <body dir=”rtl”> is good, but hardly enough
  ‣BiDi is about text directionality, right? But HTML layout raised more
  difficult issues.

  ‣LTR elements are unavoidable, even with Hebrew/Arabic only
  emails.
   Because it is BiDi!

  ‣ Typical BiDi users use a mix of English and Hebrew/Arabic emails.




                                                                           10

                                                                                10
Layout issues


   Look out for elements near the edge of the screen, esp. when resizing




                                                                                    11

                                                                                         11
Mirroring the UI can be really tricky and have a TON of bugs. psudo-rtl can help,
although it was not used for this project.
Window made larger




                                                                                      12

                                                                                            12
The window was made larger, but the menu was still in the old location, covering the
text and buttons. refresh would fix the display, but would also reload the full inbox (the
wonders of ajax)
Window made smaller




                                                                                 13

                                                                                      13
Same page- window made smaller, menu jumped off the screen (notice the scroll bars)
Contact suggestion




                                                                                  14

                                                                                       14
The suggestion to auto-complete the contact fired nicely on a Hebrew key press, but the
actual completion is way too far away (although properly RTL)
Snippets




                                                                                    15

                                                                                         15
As mentioned before, although the general order is RTL, each element needs to have it’s
own directionality, as can be seen here (broken).
Things to look out for



      ‣Menus
      ‣Fixed width elements
      ‣Absolutely positioned elements
      ‣“Auto complete” /Suggest
      ‣Resizing
      ‣Working in lower screen resolution




                                                                                   16

                                                                                        16
All of these things tend to break in RTL UI, but even more when windows get re-sized
and locations need to be re-calculated by the browser.
How to fix?


   ‣Change whole html page's direction to 'rtl‘
        ‣ Apply “dir” on “html” tag or “body” tag, like “<body dir=rtl>”.
        ‣ Not to use CSS styling to control directionality, use markup.
               -- ”Internationalization Best Practices: Handling Right-to-left Scripts in XHTML and HTML Content” by W3C



   ‣Rationale:
   ‣ Directionality is about document, not representation.
   ‣ CSS is not reliable, could be turned off or unavailable.
   ‣ Conforming user agent may ignore this CSS bidi properties.

   ‣This is considered as an exception. We strongly suggest heavy use
   of CSS in BiDi enabling. See next page…




                                                                                                                           17

                                                                                                                                17
Also, try to have clear style sheets. Why oh why didn’t begin and end get into css 3?
How to fix?


  ‣CSS offer a good separation of representation data.
  ‣Proper use of CSS is much easier to manage.
  ‣W3C best practice suggest separate CSS.
  ‣We also want a single CSS source.
     ‣ I18n and L10n will always be secondary, and will be ignored if things existing in
        separate source tree.

  ‣CSS swapping can be done on server side / client side.
  ‣ Swap 'left' and 'right'
  ‣ Swap paddings, margins, border-width, border-style …
  ‣ Some CSS property might want to stay. Better organize them into 2 sections,
    section need to be swapped and section need not.



                                                                                           18

                                                                                                18
Truncation




             19

                  19
Cut off location




                                                                                       20

                                                                                            20
In Hebrew and Arabic, the most important information is at the right, so you need to
make sure not to cut from the right. This is the display under IE
Cut off




                                                     21

                                                          21
And the same under FF- FF cut the beginning of the
text.
Cut off


   ‣Make sure to cut off from the left.
   ‣One example: Firefox table cutoff bug
   <table><tbody>
   <tr><td dir="rtl" nowrap="nowrap">
         <div style="width: 150px; overflow: hidden;">
           first second third</div></td>
       <td><- Should be cut off on the left.</td></tr>
   </tbody></table>


   ‣Solution: Wrap a fixed width div element
   <table><tbody>
   <tr><td dir="rtl" nowrap="nowrap">
         <div style="width: 150px; overflow: hidden;">
           <div style=“wdith:600px”; align=right>
           first second third
           </div> </div></td>
       <td><- Should be cut off on the left.</td></tr>
   </tbody></table>


                                                                                      22

                                                                                            22
Work around for table cut off bug in Firefox we saw- put a fixed width div inside. the
right aligned element made the browser chop off from the left.
Beware: IE 6 has a bug, causing the layout to be garbled in certain cases when there is a
div inside a cell. (fun!)
Element order




                                                                                      23

                                                                                            23
x out of y are tricky in Hebrew- each element is ltr, but the order of them is rtl. Also,
notice here that we have a run of weak and neutral characters. Need to use <span> and
&rlm; in places
How to fix?


   ‣Element order is not always consistent with layout order, because
   layout is “Bidi”.

   ‣Raise embed level:
      <span dir=”rtl”>blah blah</span>

   ‣ Insert invisible bidi mark
      &rlm; / &lrm;

   ‣Control a element group’s internal and extern directionality.
      Use embedded span tag.
      <span dir=rtl> <span dir=ltr> some text! </span></span>

   ‣Beware of browser bugs!
    If you omit the space between first 2 span tag, you will have a
   surprise.


                                                                                      24

                                                                                           24
Better to use span, but you can’t always- in those cases use the right entity.
Mozilla has a weird span tag merge "functionality". If you don't separate SPAN tags with
space and newline, thing won't happen the way you want.
Bracket issues


  Weak characters? I think not!


                                  ()
                                  []
                                  <>


                                       25

                                            25
Conversation display




                                                                                       26

                                                                                            26
you can play “find the bugs” in this picture. But the interest is the brackets (ok on top,
broken on bottom)
Contact display




                                                                                      27

                                                                                           27
The contact has set his details to have both Hebrew and English- which confuses the
display of the brackets around the email address.
28

                                              28
Notice the brackets around the English
filters
Brackets and arrows




                                                                                     29

                                                                                          29
Keep and eye open for arrows pointing at stuff, back/forward icons, and disclosure
triangles
30

     30
Brackets

     Not as weak as you might think...

    In unicode bidi layout algorithm, bracket’s directionality is
   determined by its context.

     But, each bracket is considered separately.

     Solution: span tag or &lrm;/&rlm;
   Javascript regex is a efficient way to deal with this issue.
   str.replace(/(([^)]*))|([[^]]*])|({[^}]*})|(&lt;[^&]*&gt;)/g,'<span dir="rtl">$&</span>');


    The span tag works more reliably in html context, but lrm/rlm is
   more compact.




                                                                                                      31

                                                                                                           31
In applications, and esp. in email, brackets are used for more that originally thought of,
and since they are weak, things tend to break. A few examples...
Things to look out for


  ‣ Arrows pointing to stuff
  ‣ Next / Previous icons
  ‣ Disclosure triangles
  ‣ Copyright symbol
  ‣ Brackets at element boundary




                                   32

                                        32
How to fix


   Have finer control where the element should go

    With the span trick, you can control a group of text’s external
   directionality.

     From: [label message] (16)




                                                                                     33

                                                                                          33
(Consistency sometimes is more important.) "XXX (12)" and "abc (12)" will be layed out as
"(12) XXX" and "abc (12)", that's inconsistent for column display. Other things may also
need to be "guarded". Fraction character " 1⁄4", "1⁄2", "3⁄4" are examples.
How to fix


   To:

      <span dir=rtl> [label message] </span> <span dir=rtl> (16) <span>




                                                                                     34

                                                                                          34
(Consistency sometimes is more important.) "XXX (12)" and "abc (12)" will be layed out as
"(12) XXX" and "abc (12)", that's inconsistent for column display. Other things may also
need to be "guarded". Fraction character " 1⁄4", "1⁄2", "3⁄4" are examples.
Bidirectional text editing


   For more than a few words of text, users want control!




                                                                                       35

                                                                                            35
The moment the users are going to enter more than a few words, they would like to be
able to control the directionality.
This is done by giving directionality control buttons, similar to what is seen in desktop
applications.
Bidirectional toolbar




                                                                                     36

                                                                                          36
RTL and LTR toolbars, with bidirectional controls.
Things to note:
* The current directionality and alignment are highlighted (they are related, but
separate).
* Some icons change their function/appearance according to directionality- indent,
outdent, quote, lists.
Mixing both in the same email




                                                                                     37

                                                                                          37
This is much harder than it seems, and there are many edge cases. Since we only do
“block level” inline control can’t be done.
This is the old 80/20 rule.
How it is done


  ‣Rich text editing is a complicated issue.
  ‣IE has the directionality switch functionality in design mode if you
  could accept its behavior.

  ‣In Firefox, we manipulate DOM node.
  ‣Since Firefox uses <br> to separate paragraphs, you might need to
  create new block element to apply directionality.

  ‣List needs to be treated as a whole.
  ‣Toolbar need to reflect directionality in current selection, and change
  appearance accordingly.




                                                                             38

                                                                                  38
How it is done: more on DOM


  ‣Directionality detection and switch is done on block level.
  ‣Block level elements need to be created when it is not there yet.
  ‣Block level elements could be removed when it is not needed.
  ‣Based on selection range, we need to grab all the block element
  involved.

  ‣Though directionality and alignment are separate issues, user often
  perceives them as a whole.




                                                                         39

                                                                              39
Geresh and Gershayim




 HEBREW PUNCTUATION GERESH- 05F3
 HEBREW PUNCTUATION GERSHAYIM- 05F4


                                      40

                                           40
Geresh Examples

George Bush
Winston Churchill
Jean-Jacques Rousseau

Doc. Dolittlee
Prof. Kahneman

5th of Iyar
                        41

                             41
Gershayim Examples

USA
Attorney
LTD
Accountant
UN
Katz (common sure-name)
17th of Sivan,
5,738                     42

                               42
One possible fix


  Replace latin characters with proper Hebrew ones


  function I18n_QuoteReplacementInHebrew(str) {
    for (var i = 1; i < str.length; i++ ) {
      if (str.charAt(i) == '"') {
        if (str.charAt(i-1) > 'u0590' && str.charAt(i-1) < 'u05f3') {
          str = str.substring(0, i) + 'u05f4' + str.substring(i+1);
        }
      } else if (str.charAt(i) == "'") {
        if (str.charAt(i-1) > 'u0590' && str.charAt(i-1) < 'u05f3') {
          str = str.substring(0, i) + 'u05f3' + str.substring(i+1);
        }
      }
    }
    return str;
  }




                                                                          43

                                                                               43
Summary


   •    Bidi has 2 directions, not just RTL.

   •    Apply “dir=rtl” to “html” or “body” tag.

   •    Fix page layout issues. If possible, do it through CSS.

   •    Fix text layout problems.

   •    Fix misc stuff, like image, popup dialog box, etc.

   •    Be careful about differences in browsers and each
        browser’s specific deficiency.




                                                                                       44

                                                                                            44
RTL is basically a presentation stuff, CSS can help to greatly reduce the number of
issues.
A bunch of solutions are available in JS code now, and can easily be ported to other
places.
Otherwise, try to avoid explicit alignment.
Many many bugs- don’t be afraid.

More Related Content

Similar to Gmail BiDi Enabling - A Case Study from Two Perspectives

Visualize your graph database
Visualize your graph databaseVisualize your graph database
Visualize your graph databaseMichael Hackstein
 
Domain Specific Languages
Domain Specific LanguagesDomain Specific Languages
Domain Specific Languageselliando dias
 
Fighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFabio Pellegrini
 
Responsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksResponsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksGautam Krishnan
 
Going "Metro": Branding for SharePoint 2013
Going "Metro": Branding for SharePoint 2013Going "Metro": Branding for SharePoint 2013
Going "Metro": Branding for SharePoint 2013Bryan Gulley
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5Ravi Raj
 
Embracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyEmbracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyChad Currie
 
The View - The top 30 Development tips
The View - The top 30 Development tipsThe View - The top 30 Development tips
The View - The top 30 Development tipsBill Buchan
 
The 10 Commandments of Building Global Software
The 10 Commandments of Building Global SoftwareThe 10 Commandments of Building Global Software
The 10 Commandments of Building Global SoftwareAndrey Akselrod
 
Webapp Rendering and Optimization.
Webapp Rendering and Optimization.Webapp Rendering and Optimization.
Webapp Rendering and Optimization.arthurjamain
 
10 Simple Rules for Making My Site Accessible
10 Simple Rules for Making My Site Accessible10 Simple Rules for Making My Site Accessible
10 Simple Rules for Making My Site AccessibleHelena Zubkow
 
Den Multi Device Konsumenten zufrieden stellen …
Den Multi Device Konsumenten zufrieden stellen …Den Multi Device Konsumenten zufrieden stellen …
Den Multi Device Konsumenten zufrieden stellen …Connected-Blog
 
How do I - Localization and Internationalization (l10n, i18n) - Transcript.pdf
How do I - Localization and Internationalization (l10n, i18n) - Transcript.pdfHow do I - Localization and Internationalization (l10n, i18n) - Transcript.pdf
How do I - Localization and Internationalization (l10n, i18n) - Transcript.pdfShaiAlmog1
 
Hadoop for carrier
Hadoop for carrierHadoop for carrier
Hadoop for carrierFlytxt
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty grittyMario Noble
 
Domino server and application performance in the real world
Domino server and application performance in the real worldDomino server and application performance in the real world
Domino server and application performance in the real worlddominion
 
Introduction to good_usability
Introduction to good_usabilityIntroduction to good_usability
Introduction to good_usabilityNguyen Minh
 

Similar to Gmail BiDi Enabling - A Case Study from Two Perspectives (20)

Visualize your graph database
Visualize your graph databaseVisualize your graph database
Visualize your graph database
 
Domain Specific Languages
Domain Specific LanguagesDomain Specific Languages
Domain Specific Languages
 
Fighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless php
 
Responsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksResponsive Web Design: Tips and Tricks
Responsive Web Design: Tips and Tricks
 
Going "Metro": Branding for SharePoint 2013
Going "Metro": Branding for SharePoint 2013Going "Metro": Branding for SharePoint 2013
Going "Metro": Branding for SharePoint 2013
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5
 
Embracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyEmbracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think Responsively
 
73 Less Fugly Epicenter
73 Less Fugly   Epicenter73 Less Fugly   Epicenter
73 Less Fugly Epicenter
 
Html
HtmlHtml
Html
 
The View - The top 30 Development tips
The View - The top 30 Development tipsThe View - The top 30 Development tips
The View - The top 30 Development tips
 
The 10 Commandments of Building Global Software
The 10 Commandments of Building Global SoftwareThe 10 Commandments of Building Global Software
The 10 Commandments of Building Global Software
 
Webapp Rendering and Optimization.
Webapp Rendering and Optimization.Webapp Rendering and Optimization.
Webapp Rendering and Optimization.
 
10 Simple Rules for Making My Site Accessible
10 Simple Rules for Making My Site Accessible10 Simple Rules for Making My Site Accessible
10 Simple Rules for Making My Site Accessible
 
Den Multi Device Konsumenten zufrieden stellen …
Den Multi Device Konsumenten zufrieden stellen …Den Multi Device Konsumenten zufrieden stellen …
Den Multi Device Konsumenten zufrieden stellen …
 
Big Data Overview
Big Data OverviewBig Data Overview
Big Data Overview
 
How do I - Localization and Internationalization (l10n, i18n) - Transcript.pdf
How do I - Localization and Internationalization (l10n, i18n) - Transcript.pdfHow do I - Localization and Internationalization (l10n, i18n) - Transcript.pdf
How do I - Localization and Internationalization (l10n, i18n) - Transcript.pdf
 
Hadoop for carrier
Hadoop for carrierHadoop for carrier
Hadoop for carrier
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty gritty
 
Domino server and application performance in the real world
Domino server and application performance in the real worldDomino server and application performance in the real world
Domino server and application performance in the real world
 
Introduction to good_usability
Introduction to good_usabilityIntroduction to good_usability
Introduction to good_usability
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 

Gmail BiDi Enabling - A Case Study from Two Perspectives

  • 1. Gmail BiDi Enabling - A Case Study from Two Perspectives Shoshannah Forbes, Shanjian Li 1
  • 2. Agenda ‣A quick recap of bidi ‣The challenge ‣The Goal ‣Layout issues ‣Truncation issues ‣Element order ‣Brackets ‣Bidirectional text editing ‣ Geresh & Gershayim 2 2
  • 3. A quick recap of bidi Short for “bidirectional”- text flows both from Right to Left (RTL) and Left to Right (LTR) 3 I assume that the audience here knows what bidi is, however, to make sure we are all on the same page, a quick recap is needed
  • 4. Types of directionality for characters ‣ Strong characters ‣ Weak characters ‣ Neutral characters 4 4 Strong characters- they know their directionality Weak characters- determine their directionality according to their proximity to other characters with strong directionality Neutral characters- determine their directionality from either the surrounding strong text or the embedding level
  • 5. The challenge ‣Bidi : one of the most messy problems in I18n. ‣Many bidi issues not solved cleanly in the industry yet. ‣Browser Bidi supports are buggy, and each browser behaves differently. ‣Direction change impacts whole layout, brings up many layout issues. ‣GMail is a complicated, dynamic AJAX applications with restriction of browser capability. Mail display, composing etc, and those are not static pages. 5 5
  • 6. The Goal 5 6 6 Final goal- fully mirrored UI, mixing RTL and LTR elements and text
  • 7. The goal- a closer look 7 7 Users tend to have mail both in English and in local language, so we need to be able to handle both (for example, email from international sits like facebook or last.fm). Although element order is RTL, many small details are LTR. Note the mixed language labels (and the numbers next to them), bi-directional sender names, and subject lines/snippets. Note how although the order of the elements (sender, unread count, label, subject, snippet) is rtl, each element can be either rtl or ltr.
  • 8. Just plain flipping isn’t enough 8 8 You would think that setting dir=rtl to the body or html element will do the job. But look what it caused here...
  • 9. From an early build 9 9
  • 10. More complex than seen at first glance ‣ <body dir=”rtl”> is good, but hardly enough ‣BiDi is about text directionality, right? But HTML layout raised more difficult issues. ‣LTR elements are unavoidable, even with Hebrew/Arabic only emails. Because it is BiDi! ‣ Typical BiDi users use a mix of English and Hebrew/Arabic emails. 10 10
  • 11. Layout issues Look out for elements near the edge of the screen, esp. when resizing 11 11 Mirroring the UI can be really tricky and have a TON of bugs. psudo-rtl can help, although it was not used for this project.
  • 12. Window made larger 12 12 The window was made larger, but the menu was still in the old location, covering the text and buttons. refresh would fix the display, but would also reload the full inbox (the wonders of ajax)
  • 13. Window made smaller 13 13 Same page- window made smaller, menu jumped off the screen (notice the scroll bars)
  • 14. Contact suggestion 14 14 The suggestion to auto-complete the contact fired nicely on a Hebrew key press, but the actual completion is way too far away (although properly RTL)
  • 15. Snippets 15 15 As mentioned before, although the general order is RTL, each element needs to have it’s own directionality, as can be seen here (broken).
  • 16. Things to look out for ‣Menus ‣Fixed width elements ‣Absolutely positioned elements ‣“Auto complete” /Suggest ‣Resizing ‣Working in lower screen resolution 16 16 All of these things tend to break in RTL UI, but even more when windows get re-sized and locations need to be re-calculated by the browser.
  • 17. How to fix? ‣Change whole html page's direction to 'rtl‘ ‣ Apply “dir” on “html” tag or “body” tag, like “<body dir=rtl>”. ‣ Not to use CSS styling to control directionality, use markup. -- ”Internationalization Best Practices: Handling Right-to-left Scripts in XHTML and HTML Content” by W3C ‣Rationale: ‣ Directionality is about document, not representation. ‣ CSS is not reliable, could be turned off or unavailable. ‣ Conforming user agent may ignore this CSS bidi properties. ‣This is considered as an exception. We strongly suggest heavy use of CSS in BiDi enabling. See next page… 17 17 Also, try to have clear style sheets. Why oh why didn’t begin and end get into css 3?
  • 18. How to fix? ‣CSS offer a good separation of representation data. ‣Proper use of CSS is much easier to manage. ‣W3C best practice suggest separate CSS. ‣We also want a single CSS source. ‣ I18n and L10n will always be secondary, and will be ignored if things existing in separate source tree. ‣CSS swapping can be done on server side / client side. ‣ Swap 'left' and 'right' ‣ Swap paddings, margins, border-width, border-style … ‣ Some CSS property might want to stay. Better organize them into 2 sections, section need to be swapped and section need not. 18 18
  • 19. Truncation 19 19
  • 20. Cut off location 20 20 In Hebrew and Arabic, the most important information is at the right, so you need to make sure not to cut from the right. This is the display under IE
  • 21. Cut off 21 21 And the same under FF- FF cut the beginning of the text.
  • 22. Cut off ‣Make sure to cut off from the left. ‣One example: Firefox table cutoff bug <table><tbody> <tr><td dir="rtl" nowrap="nowrap"> <div style="width: 150px; overflow: hidden;"> first second third</div></td> <td><- Should be cut off on the left.</td></tr> </tbody></table> ‣Solution: Wrap a fixed width div element <table><tbody> <tr><td dir="rtl" nowrap="nowrap"> <div style="width: 150px; overflow: hidden;"> <div style=“wdith:600px”; align=right> first second third </div> </div></td> <td><- Should be cut off on the left.</td></tr> </tbody></table> 22 22 Work around for table cut off bug in Firefox we saw- put a fixed width div inside. the right aligned element made the browser chop off from the left. Beware: IE 6 has a bug, causing the layout to be garbled in certain cases when there is a div inside a cell. (fun!)
  • 23. Element order 23 23 x out of y are tricky in Hebrew- each element is ltr, but the order of them is rtl. Also, notice here that we have a run of weak and neutral characters. Need to use <span> and &rlm; in places
  • 24. How to fix? ‣Element order is not always consistent with layout order, because layout is “Bidi”. ‣Raise embed level: <span dir=”rtl”>blah blah</span> ‣ Insert invisible bidi mark &rlm; / &lrm; ‣Control a element group’s internal and extern directionality. Use embedded span tag. <span dir=rtl> <span dir=ltr> some text! </span></span> ‣Beware of browser bugs! If you omit the space between first 2 span tag, you will have a surprise. 24 24 Better to use span, but you can’t always- in those cases use the right entity. Mozilla has a weird span tag merge "functionality". If you don't separate SPAN tags with space and newline, thing won't happen the way you want.
  • 25. Bracket issues Weak characters? I think not! () [] <> 25 25
  • 26. Conversation display 26 26 you can play “find the bugs” in this picture. But the interest is the brackets (ok on top, broken on bottom)
  • 27. Contact display 27 27 The contact has set his details to have both Hebrew and English- which confuses the display of the brackets around the email address.
  • 28. 28 28 Notice the brackets around the English filters
  • 29. Brackets and arrows 29 29 Keep and eye open for arrows pointing at stuff, back/forward icons, and disclosure triangles
  • 30. 30 30
  • 31. Brackets Not as weak as you might think... In unicode bidi layout algorithm, bracket’s directionality is determined by its context. But, each bracket is considered separately. Solution: span tag or &lrm;/&rlm; Javascript regex is a efficient way to deal with this issue. str.replace(/(([^)]*))|([[^]]*])|({[^}]*})|(&lt;[^&]*&gt;)/g,'<span dir="rtl">$&</span>'); The span tag works more reliably in html context, but lrm/rlm is more compact. 31 31 In applications, and esp. in email, brackets are used for more that originally thought of, and since they are weak, things tend to break. A few examples...
  • 32. Things to look out for ‣ Arrows pointing to stuff ‣ Next / Previous icons ‣ Disclosure triangles ‣ Copyright symbol ‣ Brackets at element boundary 32 32
  • 33. How to fix Have finer control where the element should go With the span trick, you can control a group of text’s external directionality. From: [label message] (16) 33 33 (Consistency sometimes is more important.) "XXX (12)" and "abc (12)" will be layed out as "(12) XXX" and "abc (12)", that's inconsistent for column display. Other things may also need to be "guarded". Fraction character " 1⁄4", "1⁄2", "3⁄4" are examples.
  • 34. How to fix To: <span dir=rtl> [label message] </span> <span dir=rtl> (16) <span> 34 34 (Consistency sometimes is more important.) "XXX (12)" and "abc (12)" will be layed out as "(12) XXX" and "abc (12)", that's inconsistent for column display. Other things may also need to be "guarded". Fraction character " 1⁄4", "1⁄2", "3⁄4" are examples.
  • 35. Bidirectional text editing For more than a few words of text, users want control! 35 35 The moment the users are going to enter more than a few words, they would like to be able to control the directionality. This is done by giving directionality control buttons, similar to what is seen in desktop applications.
  • 36. Bidirectional toolbar 36 36 RTL and LTR toolbars, with bidirectional controls. Things to note: * The current directionality and alignment are highlighted (they are related, but separate). * Some icons change their function/appearance according to directionality- indent, outdent, quote, lists.
  • 37. Mixing both in the same email 37 37 This is much harder than it seems, and there are many edge cases. Since we only do “block level” inline control can’t be done. This is the old 80/20 rule.
  • 38. How it is done ‣Rich text editing is a complicated issue. ‣IE has the directionality switch functionality in design mode if you could accept its behavior. ‣In Firefox, we manipulate DOM node. ‣Since Firefox uses <br> to separate paragraphs, you might need to create new block element to apply directionality. ‣List needs to be treated as a whole. ‣Toolbar need to reflect directionality in current selection, and change appearance accordingly. 38 38
  • 39. How it is done: more on DOM ‣Directionality detection and switch is done on block level. ‣Block level elements need to be created when it is not there yet. ‣Block level elements could be removed when it is not needed. ‣Based on selection range, we need to grab all the block element involved. ‣Though directionality and alignment are separate issues, user often perceives them as a whole. 39 39
  • 40. Geresh and Gershayim HEBREW PUNCTUATION GERESH- 05F3 HEBREW PUNCTUATION GERSHAYIM- 05F4 40 40
  • 41. Geresh Examples George Bush Winston Churchill Jean-Jacques Rousseau Doc. Dolittlee Prof. Kahneman 5th of Iyar 41 41
  • 42. Gershayim Examples USA Attorney LTD Accountant UN Katz (common sure-name) 17th of Sivan, 5,738 42 42
  • 43. One possible fix Replace latin characters with proper Hebrew ones function I18n_QuoteReplacementInHebrew(str) { for (var i = 1; i < str.length; i++ ) { if (str.charAt(i) == '"') { if (str.charAt(i-1) > 'u0590' && str.charAt(i-1) < 'u05f3') { str = str.substring(0, i) + 'u05f4' + str.substring(i+1); } } else if (str.charAt(i) == "'") { if (str.charAt(i-1) > 'u0590' && str.charAt(i-1) < 'u05f3') { str = str.substring(0, i) + 'u05f3' + str.substring(i+1); } } } return str; } 43 43
  • 44. Summary • Bidi has 2 directions, not just RTL. • Apply “dir=rtl” to “html” or “body” tag. • Fix page layout issues. If possible, do it through CSS. • Fix text layout problems. • Fix misc stuff, like image, popup dialog box, etc. • Be careful about differences in browsers and each browser’s specific deficiency. 44 44 RTL is basically a presentation stuff, CSS can help to greatly reduce the number of issues. A bunch of solutions are available in JS code now, and can easily be ported to other places. Otherwise, try to avoid explicit alignment. Many many bugs- don’t be afraid.