# Babel: two languages, active shorthands

I'd like to use multiple languages in my document (babel), and both ngerman and british should have the nice shorthands active (" and "'). The british language environment should turn " into “ and "' into ”. The main language should stay ngerman.

\documentclass{article}
\usepackage[british,ngerman]{babel}
\usepackage[utf8]{inputenc}
% \defineshorthand[british]{"}{\glqq}
% \defineshorthand[british]{"'}{\grqq}

\begin{document}
"Guten Tag"'

\begin{otherlanguage*}{british}
"Hello tag"'
\end{otherlanguage*}
\end{document}


Output:

expected output:

I feel totally stupid, this seems to be a pre-beginner's question.

The documentation is far from clear, but I don't think there's much more to do than redefining the shorthand to do specific tasks depending on the current language:

\documentclass{article}
\usepackage[british,ngerman]{babel}
\usepackage[utf8]{inputenc}
\languageshorthands{ngerman}%
\useshorthands*{"}%
}

\defineshorthand{"}{\iflanguage{ngerman}{\glqq}{\lq\lq}}
\defineshorthand{"'}{\iflanguage{ngerman}{\grqq}{\rq\rq}}

\begin{document}
"Guten Tag"'

\begin{otherlanguage*}{british}
"Hello tag"'
\end{otherlanguage*}
\end{document}


The problem is in the fact that you're importing the shorthands from ngerman; for instance this would work:

\documentclass{article}
\usepackage[british,ngerman]{babel}
\usepackage[utf8]{inputenc}

\useshorthands*{"}
\languageshorthands{british}%
}

\defineshorthand[british]{"}{\lq\lq}
\defineshorthand[british]{"'}{\rq\rq}

\begin{document}
"Guten Tag"'

\begin{otherlanguage*}{british}
"Hello tag"'
\end{otherlanguage*}
\end{document}
`

Of course, the other German shorthands would be lost.