Arabic and Farsi OL tags

UL tags are well used in standard-based website designs. UL tags are used for lists that could be navigation menues or any kind of lists that are of no order. OL’s are supported in different formats. Roman, Latin, and Greek numbers and alphabets. Arabic or Farsi built-in support? Let’s explore that.

As seen on W3

OL and UL tags go under the lists and generated content. The CSS property that controls lists and auto-generated(populated) content is defind under list-style-type. That’s something simple that you’ve seen and dealt with before. Come the difference. ULs are naturally and semantically to use either an image bullet or a glyphs kind of format such as disc, square and circle.

Now our friend OL. In CSS2.1 specs and definitions, OLs could be controlled by the list-style-type with the following numbering system values:

  • decimal (beginning with 1)
  • decimal-leading-zero (01, 02, 03, ..., 98, 99)
  • lower-roman (i, ii, iii, iv, v, etc.)
  • upper-roman (I, II, III, IV, V, etc.)
  • georgian (an, ban, gan, ..., he, tan, in, in-an, ...)
  • armenian (traditional Armenian numbering)

And alphabetic system values:

  • lower-latin or lower-alpha (a, b, c, ... z)
  • upper-latin or upper-alpha (A, B, C, ... Z)
  • lower-greek (α, β, γ, ...)

No Arabic or Farsi yet. Right? Disapointing. Let’s take a look at CSS3 definitions.

CSS3 definitions(not final yet), have more than Glyphs/Numeric/Alphabetic systems such as Algorithmic, Symbolic, and Non-Repeating. However the Numeric and Alphabetic systems are richer than CSS2.1 definitions.

Even thought not many browsers implemented the new CSS3 defs completly, some of the new Alphabetic and Numeric systems are applied in Firefox and Opera as of my testings.

One significant system that is applied is Hebrew wich is right-to-left(rtl) system like Arabic and Farsi. So what’s with Arabic and Farsi? Not supported yet. Let’s solve that problem until it is fully supported.

Note: You could view Arabic/Farsi numeric/alphabetic lists if you have your regional settings set as such which is not a setting in CSS nor controlled by your browser—OS controlled!

Let’s get visual

Let’s play with a simple ordered list like:

<ol>
<li>Item One</li>
<li>Item Two</li>
<li>Item Three</li>
<li>Item Four</li>
</ol>

Numeric formats:

Numeric Ordered Lists

Alphabetic Formats

Alphabetic Ordered Lists

Arabic Formats

Arabic Ordered Lists

How do we achieve the Arabic format?

We could get the Arabic format by forcing it on the document with a little Javascript. I wrote a little class to do that job and give you back Arabic OLs.

The class is called dot1_ol which you can download here.

What dot1_ol does

dot1_ol is a simple Javascript class that takes an OL element of choice by Id or Class or all the OLs in the document and:

  1. Change their list-style-type to none
  2. Get all the LI elements in the OL and attach proper numbering to them
  3. Finally replace the old OL

Let’s do that

All you have to do is first download the dot1_ol class file and embed it in your head section of your document.

<script src="path to directory/dot1_ol.js" type="text/javascript"></script>

By default dot1_ol reformats all your OL tags to numeric Arabic lists. You could use it to show you Alphabetic by changing the parameter.

Demo

There are four demo files that you could view and play with and even download listed below:

  1. Convert all OLs to Numeric Arabic OLs:
  2. Convert all OLs to Alphabetic Arabic (Alpha order) OLs
  3. Convert all OLs to Alphabetic Arabic (Abjad order) OLs
  4. Convert OLs by Id or Class to Arabic formated OLs

Need to play with these simple lists? Download the demo

This is the first attempt to do this, so the code might need a little over looking and tweaking more if needed such as nested lists and complex lists. Review it, check it out and let me know if it was of any use to you.

So, next time you have an Arabic website to design, use OLs, I got your back ;)

Related Articles

« Previous post: UAE iGroup, speaks English
» Next post: Very advanced tools, again

comments

Tuesday July 11, 2006

Bin Yousif said:

Amazing work … I like it.. Thank you..
There is a small bug for the “alphabetic” type when it reaches “قرشت”.. but its really a great work and good support for Arabic language.

#

Tuesday July 11, 2006

dotone said:

Bin Yousif, I’d be very interested to know what other features you’d like and for the bug if you could give me the error you get or the display malfunction.

#

Wednesday July 12, 2006

7usam said:

Thank you for your efforts
Keep up the good work

#

Wednesday July 12, 2006

Moey said:

wow man, thats just great

#

Wednesday July 12, 2006

Bin Yousif said:

Thank you brother. About other features you can add the normal Arabic Alphabetic order ( أ ب ت ث ...) plus your todo list.About the error you can find it http://binyousif.net/dot1/ol-arabic-alphabetic-all.htm

#

Wednesday July 12, 2006

dotone said:

I just fixed the bug, and added another feature to it. Now you can order the list in two alphabetic orders, alphabetic_alpha and alphabetic_abjad.

Thanks Bin Yousif.

#

Saturday March 17, 2007

bajranglal soni said:

i want learn arbi and farsi plz. send me alphabatic word

#

Commenting is closed for this article.

Want your link here? Use TLA

Posts by Topics
  1. Nov 4, 22:25 It's Orange, it's White, it's Laazi ads
  2. Oct 4, 02:20 Nakheel's Spam II
  3. Oct 2, 02:59 Nakheel's Spam
  4. Jul 23, 15:42 Social and Community with one button
  5. Jul 23, 13:58 Translate, Rebrand, and that's another Web Startup
  6. Jul 16, 07:11 10 Second Car
  7. Jul 16, 02:24 Domains of Branding
  8. Jul 14, 07:40 Outsourced Keystrokes