9

Consider the following MWE:

% lualatex test.tex

\DocumentMetadata{}

\documentclass{article}

\usepackage{polyglossia}
\setdefaultlanguage{danish}

\begin{document}

test

\end{document}

I get the warning

LaTeX DocumentMetadata Warning: The language has not been set in
(DocumentMetadata)              \DocumentMetadata.
(DocumentMetadata)              Setting it to 'da' as fallback.

Now to my question: If I set lang = da in \DocumentMetadata, the warning disappears as expected, but can I remove \setdefaultlanguage{danish} and still get the correct language settings throughout the document as long as lang = da is called?

I hope my question makes sense; if not, please let me know.

4
  • 2
    I get Setting it to 'da' as fallback. so it is setting to danish. en would be wrong and curious. Commented Jun 13 at 8:52
  • 1
    I also get Setting it to 'da' as fallback.: can you add \listfiles output?
    – Joseph Wright
    Commented Jun 13 at 8:58
  • @UlrikeFischer Sorry. I also get Setting it to 'da' as fallback.; I forgot that I removed \setdefaultlanguage{danish} when compiling and copy-pasting the warning. Commented Jun 13 at 9:24
  • @JosephWright Sorry. I also get Setting it to 'da' as fallback.; I forgot that I removed \setdefaultlanguage{danish} when compiling and copy-pasting the warning. Commented Jun 13 at 9:25

1 Answer 1

10

Well, I'm unsure about the warning, it can be a bit irritating and perhaps it will disappear again. But to answer the questions:

\DocumentMetadata{lang=da} will currently set only the Lang key in the PDF catalog, it will not set hyphenation patterns or fix names like "Inhaltsverzeichnis", for this you still need to use the relevant babel or polyglossia options and commands.

The Lang in the PDF catalog is important for accessibility and should be set to the main language. But the code also tries to deduce the main language from the babel/polyglossia setting. That works fine for me and I get from your document Setting it to 'da' as fallback..

I agree that it would be nice if babel/polyglossia would pick up a lang=da in \DocumentMetadata and use that to set their default language. But we have here a bit of a chicken and egg problem: As long as nobody uses the lang key there is not much for the packages to pick up. This is one reason why I made the message a warning: to get users to use the lang key more often and trigger a discussion how the language package can make use of it.

3
  • Thank you very much, as usual, for the explanation. :-) Commented Jun 13 at 9:22
  • 1
    @SvendTveskæg could you stop to change the cases? in the PDF there is the Lang key, but the tex key is lang. Commented Jun 13 at 18:57
  • Sorry! I thught it was a mistake. I'll stop immediately. Commented Jun 13 at 22:13

You must log in to answer this question.

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