Capitalize French part name

The french babel support tries to ensue that constructs like \partname~\thepart automatically get translated into "Première partie" by (locally) changing \thepart to suppress the number. This fails in your example because the \MakeUppercase make the local redefinition end before \thepart gets invoked. This can be avoided by moving \thepart into it's argument and protecting it:

Change {\MakeUppercase{\partname}~\thepart} to {\MakeUppercase{\partname~\protect\thepart}} to get "Première partie".

You can also locally redefine \frenchpartname to ensure that it works with \MakeUppercase:

Change

{\MakeUppercase{\partname}~\thepart}

to

{\renewcommand\frenchpartname{Partie}\MakeUppercase{\partname}~\thepart}

to get "PARTIE I".


The command \partname is defined to do complicated things that in your case are not needed.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[english,french]{babel}

\usepackage{titlesec}

\titleclass{\part}{top} % make part like a chapter
\titleformat{\part}[display]
    {\filleft}
    {\MakeUppercase{\partname}~\thepart}
    {1em}
    {\MakeUppercase}
\addto\captionsfrench{\renewcommand{\partname}{Partie}}

\begin{document}

%\selectlanguage{french} % French is already default
\part{Test}

\selectlanguage{english}
\part{Test}

\end{document}

enter image description here

A couple of notes: titlesec prefers \filleft to \raggedleft. There's no need to use explicit: the last token in the final mandatory argument to \titleformat is eventually followed by the braced title, so it can be a one-argument macro.

Actually, I usually discourage using explicit: better defining a separate macro that does what we want rather than clutter the argument to \titleformat with code.