Welcome to MSDN Blogs Sign in | Join | Help

Microsoft RSS Blog

All about RSS and feed technology at Microsoft and across the community
Reading feeds in Right-to-Left order

In the last few weeks, we have got some questions about how to display the IE7 Feed View in RTL (Right-To-Left) reading order, which is used by several languages.

The good news: we do have support for RTL.

IE decides whether to show a feed in RTL reading order based on one of three things:

  • The language that the feed publisher specifies in the feed
  • The default language of the browser (only if the publisher does not specify a feed language).
  • The manual reading order selection that the user makes (overrides either of the previous two)

If you are a publisher of an RSS Feed, here is what you need to do to make it show correctly.

IE‘s Feed View is looking for the RSS 2.0 language element (e.g. <language>en-us</language>), or the XML xml:lang attribute for Atom 1.0 feeds (<feed xml:lang="en">)  to determine which direction the feed page should have.

If the language the publisher indicates is known to be displayed RTL by default, IE will automatically switch the ordering. In this examples above (en is "English"), the feed will display as LTR (Left-To-Right). Conversely, if the language element is set to Arabic (<language>ar-SA</language> or just <language>ar</language> for RSS 2.0) the feed will be displayed in RTL (Right-To-Left) order.

Here is what the header of the feed should look like. The value of the language element should be changed to any of the values shown below, depending on the language of the content you are trying to display.

<?xml version="1.0"?> 
   <rss version="2.0"><channel> 
   <title>BBC Arabic News | الصفحة الرئيسية</title> 
   <link>http://news.bbc.co.uk/go/rss/-/hi/arabic/news/default.stm</link>
<language>ar</language>
...

(You can see this feed live in IE here to see what RTL feeds look like).

Atom 1.0 header should look like this:

<?xml version="1.0"?>
   <feed xmlns="
http://www.w3.org/2005/Atomxml:lang="ar">

The following languages will be displayed as RTL by default:

  1. Arabic (ar-**)
  2. Farsi (fa-**)
  3. Urdu (ur-**)
  4. Pashtu (ps-**)
  5. Syriac (syr-**)
  6. Divehi (dv-**)
  7. Hebrew (he-**)
  8. Yiddish (yi-**)

Please note: the language value must be in lowercase (e.g. ar-SA, he-IL, ur-PK, etc.). The second part of the value (which typically indicates the region), is not used in any way by IE's feed view, and may be omitted.

When the language tag is not included by the publisher, the default IE language is used. For example, if you’re using an English version of IE, then all feeds without the language element are treated as LTR. If you’re using a Hebrew version of IE, then a feed without the language element is treated as RTL.

Finally, there are times when the feed’s language is different from the default language, and the feed language element is not set by the publisher.  In this case, you can manually change the layout to RTL or LTR using the Page menu, encoding-> Right-to-Left Document: or via right-clicking directly on the page itself. See image below:

clip_image001

Hope this helps,

Nick Achmon,
Software Development Engineer in Test

Posted: Thursday, May 17, 2007 10:37 PM by rss

Comments

James Snell said:

While direction guessing based on the language can, obviously, work sufficiently in many cases, I would definitely be interested in your opinion of the Atom bidi attribute draft - http://www.ietf.org/internet-drafts/draft-snell-atompub-bidi-03.txt, which allows the direction to be set explicitly.

# May 17, 2007 8:05 PM

James Snell said:

Doh! Sorry, I updated the draft and forgot to update my own link to it! http://www.ietf.org/internet-drafts/draft-snell-atompub-bidi-04.txt

# May 17, 2007 11:27 PM

rss said:

James,

Being able to set explicit directionality in a feed is certainly a useful tool for publishers to exercise more precise control over the display of their content.

However, I also believe that allowing a publisher to simply specify the feed language, and having the reader "do the right thing" automatically is just as powerful. The set of modern languages that use rtl ordering is finite, so it is not an intractable problem.

Either way, the draft appears to be fine – the design aligns nicely with the (X)HTML “dir” attribute (which is good :). I think that in the long-run, readers should consider implementing both language-based detection, and support for the dir attribute as a way for publishers to override of the default behavior. It’s certainly something we will be looking into in the future.

Thanks for the comments and the reference.

- Sean Lyndersay

# May 18, 2007 3:00 AM

James Holderness said:

For the record, I had considered implementing language-based detection, and reached the conclusion that it would do more harm than good. Obviously, aggregator authors will make their own decisions regarding how to deal with bidirectionality, but I would't recommend what IE is doing (at least not without more evidence that there was some value in this approach).

If you're interested, the process we use in Snarfer is described at the end of this post:

http://www.詹姆斯.com/blog/2006/12/right-to-left-rss

# May 18, 2007 2:52 PM

bajaifir said:

حاولت ان اجعل الغذاء باللغة العربية ولم انجح في ذلك هل احد تمكن . شكرآ لكم  

# July 5, 2007 8:06 PM

Long said:

Hi,

do you know how to setup in internet explorer 7 encoding "CENTER document" instead of  Right-to-Left document or Left-to-Right document ?

many thanks

# July 29, 2007 7:25 AM

RSS Response said:

!ti t'nsi emit tuoba s'ti ,uoyknaht

# August 7, 2007 2:23 AM

RSS Blog said:

Very good . You are doing a great job.

# August 10, 2007 9:00 AM

eo2 said:

I wish a better integration with actual email clients

# October 3, 2007 1:57 PM

MPcomputer said:

Great!!!

it is very good for persian ( farsi ) language .

با تشکر فراوان به خاطر توجه به این نکته بسیار مهم برای فارسی زبان ها

با آرزوی موفقیت

# December 10, 2007 9:59 AM

Richard Ishida said:

There are some problems with this approach, as I see it.

[1] What will you do about Azerbaijani, etc.?  Azerbaijani language is written in both RTL (Arabic) and LTR (Cyrillic) scripts, depending on where you live. Basing the choice on language  (az in each case) doesn't scale for that type of situation.

[2] How do you cater for feeds where entries are in one language or another, or a mixture of both?  This is quite common. Rather than declaring the directionality at the feed level, you need to declare it at the item level and/or  within an item with mixed direction text.

[3] The language subtag should not be required to be case-sensitive, since this is not required in the original formats (see BCP 47).

I think you are limited here by the lack of proper bidi handling in the RSS and Atom formats, so looking at language is a workaround that addresses many cases reasonably well. I believe you should express it this way in your article above - not imply that this is a perfectly fine solution.

I hope that helps.

# December 18, 2007 6:56 AM

Tweaks said:

For the record, I had considered implementing language-based detection, and reached the conclusion that it would do more harm than good. Obviously, aggregator authors will make their own decisions regarding how to deal with bidirectionality, but I would't recommend what IE is doing (at least not without more evidence that there was some value in this approach).

# January 19, 2008 7:46 AM

Annunci Griido said:

Great Job. Just what I was looking for.. It's good for  multilanguage sites.

# February 3, 2008 6:31 PM

kursy jezyka angielskiego said:

Seems like mixture of two languages in case of Azerbaijani is too much ;)

# March 20, 2008 3:43 PM

Simon said:

Molto interessante. Lavoro ben fatto.

# May 4, 2008 5:05 PM

Pastedump said:

Very Good. I was looking for this.

# May 4, 2008 5:06 PM

Pastedump said:

Very Good. I was looking for this.

# May 4, 2008 5:06 PM

Najlepsze Ogłoszenia said:

It's a stiupid idea. That is my opinion, bezause i read left to right. ;)

# May 23, 2008 6:13 AM

Boszkowo said:

Very Good. I was looking for this.

# June 7, 2008 4:40 AM

ogłoszenia motoryzacyjne, samochody, sprzedam samochód said:

Great article. It`s realy worth reading. I wish you further successes

# July 9, 2008 6:46 AM

les1 said:

Słabo znam angielski ,więc w swoim ojczystym języku muszę stwierdzić ,że jest to dobry pomysł :)

# July 24, 2008 4:29 PM

Suplementy said:

I think it is a very good solution

# July 28, 2008 3:54 PM

omaha rules said:

Obviously, aggregator authors will make their own decisions regarding how to deal with bidirectionality, but I would't recommend what IE is doing

# July 30, 2008 1:36 PM

Matta said:

Am using this successfully in publishing content in English (one RSS feed) and Arabic (another RSS feed).

Explicitly determining the direction can be dangerous, if not well thought through. In Arabic numerals are written Left to Right within Right-to-Left text. Forcing RTL as a direction will change this. Sometimes--e.g. dates expressed as text, or code numbers for items, etc.--this forcing of RTL is required. Most times, it is not the interpretation a native would expect.

# February 9, 2009 8:29 PM

tulkSpulp said:

visit us!

newsbox.cc

newsbox.us

nbstatus.wordpress.com

NOW!

# June 11, 2009 6:00 PM

Lodeopelp said:

http://www.dug-portal.com/

BESUCHT UNS JETZT - VISIT US NOW!

# June 12, 2009 9:41 AM

eredayDyegorb said:

http://www.dug-portal.com/

BESUCHT UNS JETZT - VISIT US NOW!

# June 12, 2009 10:46 PM

UGG Classic Cardy said:

Only One word to characterize such a great post “WOW” that was a very interesting read

# September 12, 2009 2:05 AM

hotel bangkok said:

Explicitly determining the direction can be dangerous, if not well thought through.Thanks.

# October 27, 2009 10:30 PM

ร้านดอกไม้ said:

One word to characterize such a great post “WOW” that was a very interesting read. Thanks.

# October 27, 2009 10:31 PM

latest news said:

Really great news for Right-to-Left language users! You are doing a great job. Now the websites should add the language value on their rss feeds.

# November 20, 2009 4:08 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker