Previous rule | Renewal no. 036 | Next rule

The source code of each portion indicates the main language of the content

Not all speech synthesis or electronic braille tools automatically adapt to the main language of the book. This information must therefore be provided in the source code for each serving.

Objectives

  • Allow correct reading of content by a voice synth tool.
  • Facilitate machine translation.
  • Promote content indexing by language.

Implementation

  • L’attribut lang doit être ajouté à l’élément racine html du Document de Contenu pour indiquer la langue principale du texte.
  • Le code de langue doit être conforme au registre des sous-tags de langue géré par l’Internet Assigned Numbers Authority (IANA). En pratique, pour le français, cela donne : html lang="fr" (en HTML) et html lang="fr" xml:lang="fr" (en XHTML). Si la langue varie à l’intérieur d’un livre (par exemple, un texte en anglais dans un chapitre rédigé en français), vous pouvez également utiliser l’attribut lang (et xml:lang pour XHTML) sur des éléments spécifiques du document pour indiquer un changement de langue au sein d’une section.
  • Cela peut être fait sur des balises comme p, div, ou même span, pour signaler un passage en une langue différente : <p lang="en">This text is in English.</p> <p lang="fr">Ce texte est en français.</p> Si la langue principale du document change dans différentes parties du contenu, vous pouvez définir l’attribut lang (ou xml:lang pour XHTML) au niveau de plusieurs éléments parentaux, comme head, body, title, etc., pour indiquer la langue dominante dans les sections en question.

Control

  • Vérifier que l’élément racine html du Document de Contenu porte l’attribut lang, par exemple html lang="fr" (en HTML) et html lang="fr" xml:lang="fr" (en XHTML), pour indiquer la langue principale du document.
  • Check that the xml:lang attribute is also available in XHTML documents to ensure compatibility with older systems and tools that require this additional specification.
  • Make sure all multilingual content uses the lang attribute on the relevant elements, such as p, div, or span, to indicate language changes to the document integer.
  • Check that languages of metadata and content in sections like head, title, and body are well specified with the lang attribute to ensure consistency of language information.
  • Make sure the language code used in the lang attribute meets the standards established by the IANA registry of language subtags, and matches the language of the content. Please note that mul codes for “multiple languages” and “indeterminate language” should not be used. Finally, the xml:lang attribute can also be fully informed of the lang, but it is not enough to conform to this good practice.

Validation

  • Reported by epubcheck.
  • Needs to be human verified.

Informations