That should work for Ibn Saeed, but it's not a complete solution.  For example it does not work if one wants to write "page x of y" instead, with "page" and "y" written in Arabic/Persian.  Then the text of the header is partly LTR and part RTL.

This is still simple and I can use my hacky solution and mix \lefttoright and \righttoleft to get it right.  But is it possible to extend the \setupdirections[bidi=on] to apply to parts other than the main text?  I just noticed this does not apply to footnotes either.  Having numbers in the TRL footnote text produces incorrect typesetting.

On Tue, Jan 19, 2016 at 5:20 AM, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
19. Januar 2016 um 04:54
Mohammad Hossein Bateni <bateni <at> gmail.com> writes:

One hacky way to fix it is the following:

\setupheadertexts        [{\getmarking[chapter]}]    
[{\lefttoright\pagenumber}]        [{\lefttoright\pagenumber}]        
[{\getmarking[chapter]}]
Ideally \setupdirections[bidi] or something like that should be used, as I 
mentioned in the other thread; that'll fix a bunch of other problems, as 
well

I did enable \setupdirections[bidi=global] and it did not help.

Here is how it was solved. I could not use your solution as it would move 
the position of the page number of the even page on top of the chapter name.

So here is the solution derived from your answer, which works for my 
scenario.

\setupheader[margin][
	style=\righttoleft, 
	state=normal
	]     

\setupheadertexts
        [{\righttoleft\getmarking[chapter]}]    [{\pagenumber}]
        [{\pagenumber}]        [{\righttoleft\getmarking[chapter]}]

As Hans told you you can change the style for the header text in the left side only:

\setupheader[leftstyle=\righttoleft]

\setupheadertexts
  [chapter]    [pagenumber]
  [pagenumber] [chapter]

\setuppagenumbering[alternative=doublesided]

\starttext
\dorecurse{10}{\expanded{\chapter{Chapter \recurselevel}}}
\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________