Skip to content
Glossary

What is a language tag (dc:language and xml:lang)?

Updated:

A language tag is a code such as en, en-US, ar or ja that says which language a text is in, written with the BCP 47 syntax. An EPUB declares it in dc:language in the package document and with lang and xml:lang on its content documents.

Why it matters when you convert a PDF to EPUB

The language drives hyphenation, the dictionary a reader opens when you tap a word, the voice of text-to-speech and, for Arabic or Hebrew, the direction of the text. A PDF rarely declares its language reliably, so a converter has to detect it from the text itself.

EPUB 3.3 requires each dc:language value to be a well-formed BCP 47 tag; EPUBCheck reports a malformed one as OPF-092.

How EpubCC handles it: the engine detects the language from the script and common words of the text and writes the same tag in dc:language and in lang and xml:lang on every chapter. For Arabic, Hebrew, Persian and Urdu that tag also switches on dir="rtl" and right-to-left page progression.

Related terms

EPUBCheck messages about this

  • OPF-092 Language tag "…" is not well-formed: …

Convert a PDF to EPUB
Convert up to 5 pages free, no account needed.

Sources

FAQ

What is a language tag (dc:language and xml:lang)?

A language tag is a code such as en, en-US, ar or ja that says which language a text is in, written with the BCP 47 syntax. An EPUB declares it in dc:language in the package document and with lang and xml:lang on its content documents.