# How to obtain current language in polyglossia

How to obtain the current language set by \setotherlanguage{english} ?

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{czech}
\begin{document}
\ifthenelse{\equal{\xpg@other@language}{czech}}{A}{B} %macro doesn't exist
\setotherlanguage{english}
\ifthenelse{\equal{\xpg@other@language}{czech}}{A}{B}
\end{document}


I want output like AB. But macro \xpg@other@language does not exist and documentation is very poor. \xpg@main@language returns czech as I expected.

• There can be more than one "other" language, so the equal test doesn't make sense. What are you trying to achieve? Beside this your document doesn't load the ifthen package, and your are not making @ a letter before the tests. – Ulrike Fischer Feb 20 '16 at 13:01
• Ok, the question might be: How to obtain english just before \end{document}? I'm trying to distinguish between languages in my own-written macros. Of course you are right with \makeatletter and ifthenelse but this mess doesn't change a meaning. – Luuuucky Feb 20 '16 at 13:46

I guess you are looking for something like this:

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{czech}
\setotherlanguage{english}
\begin{document}
\iflanguage{czech}{czech}{no}

\selectlanguage{english}

\iflanguage{czech}{czech}{no}

\end{document}