I am writing a book in Urdu using polyglossia package. Urdu text goes from right to left but numbers are written from left to right. The number format is correct everywhere except in the section numbering in the table of contents and references. The minimal example that reproduces the error is as follows
\documentclass{book}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{urdu}
\def\urdunumber#1{\protect\farsidigits{\number#1}}
\setotherlanguage{english}
\setmainfont[
Script=Arabic,
Extension=.ttf,
Scale=1.0]{JameelNooriNastaleeq}
\setmonofont{DejaVu Sans Mono}
\let\urdufontt\ttfamily
\author{احمد}
\title{کتاب}
\begin{document}
\sloppy
\frontmatter
\maketitle
\tableofcontents
\pagestyle{empty}
\chapter{دیباچہ}
\mainmatter
\pagestyle{headings}
\chapter{پہلا}
\section{حصہ اول}
\section{حصہ دوم}
\begin{equation}
a+b
\end{equation}
\begin{equation}
\label{test}
a+c
\end{equation}
دوسری مساوات \ref{test}
\backmatter
\end{document}
The section numbers in the table of content follow the RTL direction.
The reference generated by \ref also follows the RTL direction.
Any Help would be highly appreciated