6

I am currently writing a class and there I need to test the current language. Therefore I use the package iflang. A strange warning pops up when I change the default language, consider:

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\usepackage{iflang}
\begin{document}
\makeatletter
\noindent PATT: \the\l@dutch \\
LANG: \the\language
\makeatother
\end{document}

The code does not produce any warnings, but if I change the code to \setdefaultlanguage{dutch}, the package iflang produces a warning:

Package iflang Warning: Mismatch between \language (patterns)
(iflang)                and setting of \languagename.

despite the two variables having the same value. Is this a bug in the package?

1 Answer 1

7

After

\usepackage{polyglossia}
\setdefaultlanguage{dutch}

the language name is dutch, but the language setting is still the default language 0 (USenglish). Thus the warning is correct. Package polyglossia sets the language later in \begin{document}.

The warning can be avoided:

  • Loading the package later, when polyglossia has set the language:

    \usepackage{polyglossia}
    \setdefaultlanguage{dutch}
    \AtBeginDocument{\usepackage{iflang}}
    
  • Or explicit setting of the language:

    \usepackage{polyglossia}
    \setdefaultlangauge{dutch}
    \selectlanguage{dutch}
    \usepackage{iflang}
    
  • Or loading package iflang earlier:

    \usepackage{iflang}
    \usepackage{polyglossia}
    \setdefaultlanguage{dutch}
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .