Index: mythtv/libs/libmythtv/osdlistbtntype.cpp
===================================================================
--- mythtv/libs/libmythtv/osdlistbtntype.cpp	(revision 19467)
+++ mythtv/libs/libmythtv/osdlistbtntype.cpp	(working copy)
@@ -65,6 +65,10 @@
     m_hmult        = (hmult == 0.0f) ? 1.0f : hmult;
     m_unbiasedarea = unbias(area,      wmult, hmult);
     m_unbiasedsize = unbias(levelsize, wmult, hmult);
+    if (gContext->GetLanguage()=="he")
+	m_isRtl = true;
+    else
+	m_isRtl = false;
 }
 
 OSDListTreeType::~OSDListTreeType()
@@ -74,6 +78,17 @@
         delete *it;    
 }
 
+void OSDListTreeType::SetRtl (bool isRtl)
+{
+/***
+	m_isRtl = isRtl;
+if (gContext->GetLanguage()=="he")
+	m_isRtl = true;
+    else
+	m_isRtl = false;
+***/
+}
+
 void OSDListTreeType::Reinit(float wmult, float hmult)
 {
     m_wmult     = (wmult == 0.0f) ? 1.0f : wmult;
@@ -140,9 +155,20 @@
     {
         QString levelname = QString("level%1").arg(i + 1);
         QRect curlevelarea = m_levelsize;
-        curlevelarea.moveBy(m_totalarea.x(), m_totalarea.y());
-        curlevelarea.moveBy((m_levelsize.width() + m_levelspacing) * i, 0);
-
+	
+// if we are left to right
+	if (false == m_isRtl)
+        {
+		curlevelarea.moveBy(m_totalarea.x(), m_totalarea.y());	
+        	curlevelarea.moveBy((m_levelsize.width() + m_levelspacing) * i, 0);
+	}
+        
+// if we are right to left
+	else
+	{
+		curlevelarea.moveBy(m_totalarea.width(), m_totalarea.y());
+        	curlevelarea.moveBy( ((-1 - i) * m_levelsize.width()) - m_levelspacing,0);
+	}
         OSDListBtnType *newlevel = new OSDListBtnType(
             levelname, curlevelarea, m_wmult, m_hmult, true);
 
@@ -214,22 +240,42 @@
         GetLevel(m_levelnum)->MovePageDown();
         EnterItem();
     }
-    else if (has_action("LEFT", actions) && (m_levelnum > 0))
+    else if (!m_isRtl && has_action("LEFT", actions) && (m_levelnum > 0))
     {
+
         GetLevel(m_levelnum)->Reset();
         GetLevel(m_levelnum)->SetVisible(false);
 
         m_levelnum--;
         EnterItem();
     }
-    else if ((has_action("LEFT", actions) && m_arrowAccel) ||
+
+    else if (m_isRtl && has_action("LEFT",actions))
+	{
+		// Right to left - left acts as select / advance one stage
+		if ((m_levelnum + 1 < m_depth) &&
+		    (currentpos->childCount() > 0))	
+		{
+			GetLevel(m_levelnum)->SetActive(false);
+			m_levelnum++;
+		
+			FillLevelFromTree(currentpos, m_levelnum);
+			GetLevel(m_levelnum)->SetVisible(true);
+			EnterItem();
+		}
+		else
+		{
+			SelectItem();
+		}
+	}	
+    else if ((!m_isRtl &&  has_action("LEFT", actions) && m_arrowAccel) ||
              has_action("ESCAPE",   actions) ||
              has_action("CLEAROSD", actions) ||
              has_action("MENU",     actions))
     {
         m_visible = false;
     }
-    else if (has_action("RIGHT", actions) &&
+    else if (!m_isRtl && has_action("RIGHT", actions) &&
              (m_levelnum + 1 < m_depth) &&
              (currentpos->childCount() > 0))
     {
@@ -240,11 +286,20 @@
         GetLevel(m_levelnum)->SetVisible(true);
         EnterItem();
     }
-    else if ((has_action("RIGHT", actions) && m_arrowAccel) ||
+    else if ((!m_isRtl && has_action("RIGHT", actions) && m_arrowAccel) ||
              has_action("SELECT", actions))
     {
         SelectItem();
     }
+    else if ((true ==m_isRtl) && has_action("RIGHT",actions) && (m_levelnum > 0))
+	{
+		GetLevel(m_levelnum)->Reset();
+		GetLevel(m_levelnum)->SetVisible(false);
+	
+		m_levelnum--;
+		EnterItem();
+	}
+
     else
     {
         return false;
@@ -662,7 +717,10 @@
     LoadPixmap(m_checkNonePix, "check-empty");
     LoadPixmap(m_checkHalfPix, "check-half");
     LoadPixmap(m_checkFullPix, "check-full");
-    LoadPixmap(m_arrowPix, "arrow");
+    if (gContext->GetLanguage()=="he")
+       LoadPixmap(m_arrowPix, "ltarrow");
+    else
+       LoadPixmap(m_arrowPix, "arrow");
 
     uint itemWidth = (m_rect.width() + 1) & (~1);
 
@@ -751,8 +809,12 @@
     if (m_checkable) 
         m_checkRect  = QRect(margin, (height - ch)/2, cw, ch);
 
-    if (m_showArrow) 
-        m_arrowRect  = QRect(width - aw - margin, (height - ah)/2, aw, ah);
+    if (m_showArrow)
+	if (gContext->GetLanguage() == "he")
+		m_arrowRect  = QRect(m_parent->m_contentsRect.x() + margin, (height - ah)/2, aw, ah);
+	else
+		m_arrowRect  = QRect(width - aw - margin, (height - ah)/2, aw, ah);
+	
 
     if (m_pixmap)
     {
@@ -764,7 +826,12 @@
     tx += (m_checkable) ? m_checkRect.width()  + margin : 0;
     tx += (m_pixmap)    ? m_pixmapRect.width() + margin : 0;
     tw -= (m_checkable) ? m_checkRect.width()  + margin : 0;
+    
     tw -= (m_showArrow) ? m_arrowRect.width()  + margin : 0;
+    
+    if (gContext->GetLanguage()=="he")
+	tx += (m_showArrow) ? m_arrowRect.width()  + margin : 0;
+
     tw -= (m_pixmap)    ? m_pixmapRect.width() + margin : 0;
     m_textRect = QRect(tx, 0, tw, height);
 
Index: mythtv/libs/libmythtv/ttfont.h
===================================================================
--- mythtv/libs/libmythtv/ttfont.h	(revision 19467)
+++ mythtv/libs/libmythtv/ttfont.h	(working copy)
@@ -8,7 +8,7 @@
 #include <qstring.h>
 #include <qmap.h>
 #include <qcolor.h>
-
+#include <qmutex.h> 
 #include "config.h"
 
 #ifdef HAVE_STDINT_H
@@ -67,7 +67,13 @@
                      int offset_y, int xstart, int ystart, int width, 
                      int height, int alphamod, kTTF_Color k = kTTF_Normal);
      bool cache_glyph(unsigned short c);
-
+	
+	 QString ConvertFromRtoL(const QString &text) const; 
+ 		 
+ 	 static QString BasicConvertFromRtoL(const QString &text); 
+ 	
+	
+	
      bool         valid;
      FT_Library   library;
      FT_Face      face;
@@ -104,6 +110,9 @@
      int loadedfontsize;
      float m_wscale;
      float m_hmult;
+	
+	mutable QMutex      fribidi_lock; 
+ 	mutable QTextCodec *codeci;
 };
 
 #endif
Index: mythtv/libs/libmythtv/osdlistbtntype.h
===================================================================
--- mythtv/libs/libmythtv/osdlistbtntype.h	(revision 19467)
+++ mythtv/libs/libmythtv/osdlistbtntype.h	(working copy)
@@ -108,6 +108,8 @@
     bool HandleKeypress(QKeyEvent *e);
     void Draw(OSDSurface *surface, int fade, int maxfade, int xoff, int yoff);
 
+    void SetRtl (bool isRtl);
+
   signals:
     void itemSelected(OSDListTreeType *parent, OSDGenericTree *item);
     void itemEntered(OSDListTreeType *parent, OSDGenericTree *item);
@@ -151,6 +153,7 @@
     int       m_levelnum;
     bool      m_visible;
     bool      m_arrowAccel;
+    bool      m_isRtl;
 };
  
 class OSDListBtnType : public OSDType
Index: mythtv/libs/libmythtv/ttfont.cpp
===================================================================
--- mythtv/libs/libmythtv/ttfont.cpp	(revision 19467)
+++ mythtv/libs/libmythtv/ttfont.cpp	(working copy)
@@ -21,6 +21,11 @@
 
 #include <iostream>
 
+#ifdef USING_FRIBIDI 
+#include "fribidi/fribidi.h" 
+#include <qtextcodec.h>  
+#endif // USING_FRIBIDI 
+
 using namespace std;
 
 #include <cstdio>
@@ -30,6 +35,7 @@
 
 #include "osdtypes.h"
 #include "osdsurface.h"
+#include "mythcontext.h"
 
 static int          have_library = 0;
 static FT_Library   the_library;
@@ -430,6 +436,103 @@
                                surface->pow_lut);
 }
 
+QString TTFFont::BasicConvertFromRtoL(const QString &text) 
+ 	{ 
+ 	    QStringList rtl_string_composer; 
+ 	    bool handle_rtl = false; 
+ 	    QChar prev_char; 
+ 		 
+ 	    // Handling Right-to-Left languages. 
+ 	    // Left-to-Right languages are not affected. 
+
+	    // first,we need to ignore all the spaces in the end of the string
+	    int lastCharIdx = (int)text.length() - 1;
+	    while (text[lastCharIdx].isSpace())
+		lastCharIdx--;
+ 	    for (int i = lastCharIdx; i >= 0; i--) 
+ 	    { 
+ 	        QChar::Direction text_dir = text[i].direction(); 
+ 	        if (text_dir != QChar::DirR &&  
+ 	            text_dir != QChar::DirRLE && 
+ 	            text_dir != QChar::DirRLO) 
+ 		        { 
+ 		            if (handle_rtl || rtl_string_composer.empty()) 
+ 		                rtl_string_composer.append(QString()); 
+ 		 
+ 		            if (text[i].isSpace() && !prev_char.isNull() 
+ 		                    && prev_char.isDigit() && handle_rtl) 
+ 		                rtl_string_composer.back().append(text[i]); 
+ 		            else 
+ 		                rtl_string_composer.back().prepend(text[i]); 
+ 		 
+ 		            prev_char = text[i]; 
+ 		 
+ 		            handle_rtl = false; 
+ 		        } 
+ 		        else 
+ 		        { 
+ 		            if (!handle_rtl) 
+ 		            { 
+ 		                rtl_string_composer.append(QString()); 
+ 		                handle_rtl = true; 
+ 		                prev_char = QChar(); 
+ 		            } 
+ 		            rtl_string_composer.back().append(text[i]); 
+ 		        } 
+ 		    } 
+ 		 
+ 		    QString output = rtl_string_composer.join(""); 
+ 		 
+ 		//    return QDeepCopy<QString>(output); 
+ 		    return output; 
+ 		} 
+ 		 
+QString TTFFont::ConvertFromRtoL(const QString &text) const 
+{ 
+	QString output = BasicConvertFromRtoL(text); 
+// cout<< output;
+#ifdef USING_FRIBIDI 
+		cout<<"fribidi";
+	QMutexLocker locker(&fribidi_lock); 
+	if (!codeci) 
+		codeci = QTextCodec::codecForName("utf8"); 
+ 
+	if (!codeci) 
+		return output; 
+ 
+	QCString temp = codeci->fromUnicode(text); 
+ 
+	FriBidiCharType base; 
+	size_t len; 
+ 
+	bool fribidi_flip_commas = true; 
+	base = (fribidi_flip_commas) ? FRIBIDI_TYPE_ON : FRIBIDI_TYPE_L; 
+ 
+	const char *ip = temp; 
+	FriBidiChar logical[strlen(ip) + 1], visual[strlen(ip) + 1]; 
+ 
+	int char_set_num = fribidi_parse_charset("UTF-8"); 
+
+	len = fribidi_charset_to_unicode( 
+	(FriBidiCharSet) char_set_num, (char *)ip, strlen(ip), logical); 
+
+	bool log2vis = fribidi_log2vis( 
+	logical, len, &base, visual, NULL, NULL, NULL); // output 
+
+	if (log2vis) 
+	len = fribidi_remove_bidi_marks(visual, len, NULL, NULL, NULL); 
+
+	output = ""; 
+	for (size_t i = 1; i < len ; i++) 
+	    output += QChar(visual[i]); 
+	
+	
+        #endif // USING_FRIBIDI 
+
+	return output; 
+} 
+
+
 void TTFFont::DrawString(OSDSurface *surface, int x, int y, 
                          const QString &text, int maxx, int maxy, 
                          int alphamod, bool double_size)
@@ -452,7 +555,7 @@
    }
    rmap = create_font_raster(w, h);
 
-   render_text(rmap, rtmp, text, &inx, &iny, double_size);
+   render_text(rmap, rtmp, ConvertFromRtoL(text), &inx, &iny, double_size);
 
    is_pixmap = 1;
 
@@ -496,12 +599,19 @@
        return;
    }
 
+	if (gContext->GetLanguage()=="he")
+	{
+		x = maxx - width;
+	}
+
    if (m_shadowxoff != 0 || m_shadowyoff != 0)
    {
        merge_text(surface, rmap, clipx, clipy, x + m_shadowxoff,
                   y + m_shadowyoff, width, height, alphamod, kTTF_Shadow);
    }
 
+	
+
    if (m_outline)
    {
        merge_text(surface, rmap, clipx, clipy, x - 1, y - 1, width, height,
@@ -514,6 +624,7 @@
                   alphamod, kTTF_Outline);
    }
 
+   
    merge_text(surface, rmap, clipx, clipy, x, y, width, height, alphamod);
 
    destroy_font_raster(rmap);
Index: mythtv/libs/libmythtv/osd.cpp
===================================================================
--- mythtv/libs/libmythtv/osd.cpp	(revision 19467)
+++ mythtv/libs/libmythtv/osd.cpp	(working copy)
@@ -1298,6 +1298,7 @@
     uint    grSelectedAlpha(255);
     int     spacing = 2;
     int     margin = 3;
+    bool    isRtl = false;	
 
     QString name = element.attribute("name", "");
     if (name.isNull() || name.isEmpty())
@@ -1312,7 +1313,18 @@
         QDomElement info = child.toElement();
         if (!info.isNull())
         {
-            if (info.tagName() == "area")
+	    if (info.tagName() == "RTL")
+		{
+			if (getFirstText(info) == "yes")
+			{
+				isRtl = true;
+			}
+			else if (getFirstText(info) == "no")
+			{
+				isRtl = false;
+			}
+		}	
+            else if (info.tagName() == "area")
             {
                 area = parseRect(getFirstText(info));
                 normalizeRect(area);
@@ -1428,6 +1440,8 @@
     lb->SetSpacing(spacing);
     lb->SetMargin(margin);
 
+    lb->SetRtl(isRtl);
+
     container->AddType(lb);
 }
 
