On Wed, Aug 05, 2026 at 07:59:15PM +0100, David Carlisle wrote: > > However, I don't know what problem is being solved by outputting the > document > language with this command. > > specifying the language is mandated by the PDF/UA-2 accessibility standard.
Searching online for this standard leads to this page: https://pdfa.org/iso-14289-2-pdf-ua-2-the-gold-standard-for-accessibility-in-pdf-2-0-has-arrived/ - which references an ISO 14289-2 standard. It says that the ISO standard is not available for free, but it is based on another specification called WTPDF. Here is the page for WTPDF: https://pdfa.org/wtpdf Well, the linked file "Well-Tagged-PDF-WTPDF-1.0.pdf" doesn't contain the text "BCP-47" anywhere: 8.4.4 Declaring natural language The language of all content and text strings shall be specified. NOTE 1 Where a file includes Unicode text strings with two or more languages requiring three-letter language codes, it is possible that the language of some text is not representable. The default natural language for content and text strings shall be specified using the Lang entry, with a non-empty value, in the document catalog dictionary. Changes in the natural language shall be declared using the methods described in ISO 32000- 2:2020, 14.9.2. Changes in natural language inside text strings (e.g. inside alternate descriptions) shall be declared using a language identifier as described in ISO 32000-2:2020, 7.9.2.2. (Odd that copying and pasting from a standards document on "accessible PDF" has produced apparent garbage for space characters, but hopefully you can read it.) ISO 32000 is the PDF standard. Well, I couldn't download that standard without registering, so I haven't looked at it. But I have the PDF Reference Manual Sixth Edition (for PDF 1.7) saved on my computer (as it is or was easily available online). There the relevant section is 10.8.1 "Natural Language Specification": > Language Identifiers > Certain language-related dictionary entries are text strings that specify > language > identifiers. Such text strings appear as Lang entries in the following > structures or > dictionaries: > • Document catalog, structure element dictionary, or property list > • Optional content usage dictionary’s Language dictionary, although the > hierar- > chical issues described in “Language Specification Hierarchy,” below do not > ap- > ply to this entry > A language identifier can either be the empty text string, to indicate that > the lan- > guage is unknown, or a Language-Tag as defined in RFC 3066, Tags for the > Identi- > fication of Languages. This section provides an informal summary of RFC 3066. RFC 3066 is indeed the same as BCP-47, more or less. (RFC 3066 is a superseded specification.) It's slightly odd that the ISO PDF standard would reference the non-ISO RFC, although there may be nuances to this that I am not aware of. We discussed the use of BCP-47 languages recently on this list as I believe we were going to use them in the HTML output, as commonly used on the web. The discussion came about due to Patrice's proposal to add a way to the Texinfo language to specify both document script (e.g. Latin or Cyrillic) and language variant (e.g. dialects of Occitan). I was concerned at the time about possible lack of quality in the IETF language subtag registry as compared with ISO 639, although it would unlikely be a problem in practice (as users do not have to use the new @documentlanguagevariant command). > When generating tagged PDF > latex will always add a language, defaulting to `en`. > > Users don't have to know the BCP codes (although they can be used that way) > but typically they can use a language package such as babel that takes > friendlier names such as > > \usepackage[german]{babel} > > babel will set up fixed texts and hyphenation for german and (for tagged > documents) will also arrange that lang=de gets added. > but if texinfo already has the language in bcp 47 form to hand then it > could directly add it in documentmetada. I expect it should be possible as Patrice already did the work to get the language in this format for the HTML output.
