cleveref uses \edef
on the label name, and this doesn't like the active colon. You can try to make it protected (but it would be imho nicer if the babel definitions were protected by default):
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} %% For UTF8 chars (accented letters).
\usepackage[english,french]{babel}
\usepackage[colorlinks]{hyperref}
\usepackage[capitalise,noabbrev]{cleveref}
\begin{document}
% after begin document:
\addto\extrasfrench{\protected\edef:{\unexpanded\expandafter{:}}}
\selectlanguage{french}
The section is \cref{sec:mysection}.
\section{My section}\label{sec:mysection}
text: text
\selectlanguage{french}
The section is \cref{sec:mysection}.
\selectlanguage{english}
The section is \cref{sec:mysection}.
\end{document}
An alternative is to make the colon safe locally, but it would change typesetting if it done for the whole command so one have to guess a place where to switch that off again (and perhaps there are other commands which still break ...):
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[english,french]{babel}
\usepackage[colorlinks]{hyperref}
\usepackage[capitalise,noabbrev]{cleveref}
\usepackage{etoolbox}
\makeatletter
\patchcmd\@cref{\begingroup}{\begingroup\@safe@activestrue}{}{\fail}
% it is only a guess that the following a good place to reactivate the active chars ...
\patchcmd\@cref{\cref@isstackfull{\@refsubstack}}{\cref@isstackfull{\@refsubstack}\@safe@activesfalse}{}{\fail}
\makeatother
\begin{document}
The section is \cref{sec:mysection}
\section{My section}\label{sec:mysection}
text: text
\end{document}
\usepackage[French]{cleveref}
and you can't use:
because it is a special symbol in the French Babel. I couldn't find an easy work around, sadly.cleveref
's manual, at the "Non-bugs" section. For what it's worth,zref-clever
can handle it. And, off-topic, you no longer need to specify\usepackage[utf8]{inputenc}
, it's already the default.