Digital-Humanities-Quarterly / dhq-journal

DHQ is an open-access, peer-reviewed journal of digital humanities.
http://www.digitalhumanities.org/dhq/
10 stars 5 forks source link

Add xml:lang on <p> #14

Open juliaflanders opened 1 year ago

juliaflanders commented 1 year ago

Needed for multilingual examples

juliaflanders commented 1 year ago

When making this update, we should also add @xml:lang on <q>, <quote>, <said>, and <term>

amclark42 commented 1 month ago

Accurately marking the language of textual content is an accessibility issue (WCAG 2.2 success criterion 3.1.2). Among other uses, screen readers rely on language tags to determine how words should be pronounced.

In a recent article, @brgrey and I found that @xml:lang is also needed on elements such as <ab>, <label>, <note>, and <hi>, and likely others. In order to mark that an example is in German, Benjamin could not place the @xml:lang on the part of the example in that language. Instead, he had to put the @xml:lang on the <dhq:example>, which is then lying about the language of the labels, legend, and note (which are in English). To override the German language code, we'd need to put @xml:lang="en" on <ab>, <label>, <note>, and <dhq:caption>.

Below is a simplified example of what we ran into.

<dhq:example xml:id="example01" xml:lang="de">
<ab xml:lang="en"><label>The preliminary categories:</label><!-- @xml:lang is invalid here --> 
  person, occupation, place, cause-of-death, age
  <lb/>
  <lb/> </ab>
<ab><label xml:lang="en">A sample annotated record:</label><!-- @xml:lang is invalid here --> 
  Der <hi>Johann Rendt</hi> / ein <hi>Zuckerbacher</hi> in
  <hi>Berdronischen Hauß</hi> in <hi>Offenloch</hi> ist an der <hi>Lungelsucht</hi>
  beschaut alt <hi>35. Jahr</hi>. (WD 08.08.1703:
  9)<note xml:lang="en"><!-- @xml:lang is invalid here --> 
    Here and in the following sections, text passages from the <title rend="italic">Wien[n]erisches
    Diarium</title> (WD) or from the <title rend="italic">Wiener Zeitung</title> (WZ) will be quoted with their date
    of publication and page number.</note></ab>
  <dhq:caption xml:lang="en"><!-- @xml:lang is invalid here -->
    <p>In the annotated record, “Johann Rendt” is coded as a “person”; “Zuckerbacher” is coded 
      as an “occupation”; “Berdronischen Hauß” and “Offenloch” are coded as “place”; 
      “Lungelsucht” is coded as “cause of death”; and “35. Jahr” is coded as “age”.</p>
  </dhq:caption>
</dhq:example>

It might be easier to make @xml:lang a global attribute, as the TEI does.

Unfortunately, this will only fix the encoding. As @sydb points out in #74, the DHQ stylesheets don't consistently put @xml:lang in the HTML, even when the attribute is valid.

brgrey commented 1 month ago

Per a conversation in the managing editors' meeting on 31 May, 2024, @xml:lang should be made a global attribute to match the TEI as @amclark42 suggested above. Other examples (most recently DHQ article 000716) continue to appear where the attribute ought to be valid across all elements which carry textual content, but isn't according to the present schema.