Can you set the Natural Language of a PDF compiled with pdflatex?

The following document passes the test that you linked. It should be obvious from the example how to set the language.

\documentclass{article}

\usepackage{hyperref}
\hypersetup{
  pdftitle={Test},
  pdflang={en-US}, % PDF language identifier (RFC 3066)
}

\begin{document}

\section{foobar}

\end{document}

If for some reason you cannot use hyperref, you can also modify the PDF catalog by hand using

\pdfcatalog{/Lang (en-US)}

None of the above is sufficient if you want to generate truly accessible PDF. All it does it shutting up this particular checker.


The Answer of Henri Menke is outdated as of 2020.

There is now a more elegant way of setting the language through usage of package hyperxmp:

\documentclass{article}

\usepackage{hyperref}
\usepackage[english]{babel}
\usepackage{hyperxmp}[2020/06/15]

\title{Test}

\begin{document}

\section{foobar}

\end{document}

Instead of babel you can also use

\usepackage{polyglossia}
\setdefaultlanguage[variant=US]{english}

Do not use \pdfcatalog{/Lang (en-US)} since this method does not write XMP metadata. Some readers relying on it may not work properly. Furthermore, \pdfcatalog will only contain the main language whereas XMP will contain all major languages. If you do not want hyperlinks use the NoHyper environment.