Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Page Properties


Document status
Status
colourRed
titleIn Progress
Document ownerLakhan Mandloi
DevelopersLakhan MandloiRaghavendra V
Related JIRA cards
  • Jira Legacy
    serverSystem JIRA
    serverId2207a759-5bc8-39c5-9cd2-aa9ccc1f65dd
    keySB-7368
     
  • Jira Legacy
    serverSystem JIRA
    serverId2207a759-5bc8-39c5-9cd2-aa9ccc1f65dd
    keySB-6159
  • Jira Legacy
    serverSystem JIRA
    serverId2207a759-5bc8-39c5-9cd2-aa9ccc1f65dd
    keySB-8498


...

  • Adding attribute dir="rtl" reverses the directionality of the element. 

  • Adding attribute lang="**" is useful for the browser, Search engines and Web accessibility tools.
  • From the performance perspective, all languages fonts should not be downloaded by default. A font file should be downloaded based on the need basis.

Implementation Details

HTML Side changes

  • Based on the user opted language for the interface, HTML tag must contain lang and dir attribute. If the user has not opted any language, English will be the default.  Eg - <html lang="en-GB" dir="ltr">. 

  • Based on the content a content element loads, the content element should have lang and dir attributes. Eg - If a card contains the Urdu content - <app-card lang="ur" dir="rtl">

CSS Side Changes

  • All language and directional CSS will be served from the single CSS file. i.e. style.css. No Separation of CSS files based on directionality or Language. Performance related concerns/challenges can be handled in effective ways.
  • Directional Challenges (Avoiding duplicate codes)
    • Some properties which break the inherited directionality of element should be avoided as much as possible such as - text-align, float, left and right properties etc. Eg - an element with CSS property text-align: left will not change directionality to right on changing HTML dir="rtl" hence should be avoided.
    • Directionality breaking CSS properties should be replaced with the reusable classes. Eg - mr-20 will add margin-right: 20px in ltr but in rtl it will add margin-left: 20px. Directional properties will be nested with the directional attribute so as to isolate them. Eg- *[dir=ltr] .mr-20{margin-right:20px;} and *[dir=rtl] .mr-20{margin-left:20px;}.
  • Multi-font Challenges (Avoid downloading font files if language not used on the page)
    • Language special CSS will be written with nesting to language attribute selector rather than assigning it to the body tag. Eg - *[lang=ur] {font-family: "Noto Nastaliq Urdu";}
    • More details on - https://ui-demo.github.io/fonts2.html

Some Useful links -

...