Parts not working when using multiple languages with polyglossia

I'm working on a book document with xelatex. The document is divided into parts, and I have the occasional need to switch between two languages.

I've found that when my document contains more than one language, the part number is not displayed anymore:

\documentclass{book}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}

\begin{document}
\selectlanguage{french}
\selectlanguage{english}

\part{My Part}
\end{document}


Will result in:

If I use just one language, I'm not having any problem:

\documentclass{book}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}

\begin{document}
% \selectlanguage{french}
\selectlanguage{english}

\part{My Part}
\end{document}


Chapters and sections work good in any case.

The french language redefines \thepart to issue nothing, because it wants “Première partie”. So if you switch to French, the command is redefined, but switching to English doesn't define it back.

\documentclass{book}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}

\makeatletter
\let\latex@thepart\thepart
\appto\noextras@french{\let\thepart\latex@thepart}
\makeatother

\begin{document}

\selectlanguage{french}
\selectlanguage{english}

\part{My Part}

\end{document}


Save the original \thepart command and restore it when the language switches from French to another one.

• Thanks a lot, it makes a lot of sense, and your solution is working great! – Romain Endelin Feb 7 '16 at 1:01