[Tex/LaTex] babel’s hyphenation-friendly hyphen “= in multiple languages

babelhyphenationlanguagesshorthands

Why doesn't the hyphenation work with multiple languages? See code:

\documentclass[a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english,ngerman]{babel}

\begin{document}
Mein deutscher Bindestrich"=Test.

\selectlanguage{english}
My english Hyphon"=Test. <--- Here should be a - and not "=
\selectlanguage{ngerman}
\end{document}

Best Answer

\documentclass[a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english,ngerman]{babel}
\useshorthands{"}
\addto\extrasenglish{\languageshorthands{ngerman}}
\begin{document}
Mein deutscher Bindestrich"=Test.

\foreignlanguage{english}{%
My english Hyphon"=Test. <--- Here should be a - and not "=}

\end{document}

By the way: using \selectlanguage makes sense only when you want to switch completely to the other language (date, titles, ...)

Related Question