Adding < lang > attributes for non‑English content


Read time: 6 minutes

Summary

CT.gov provides automated translation through the language picker. In most cases, editors should create and maintain content in English and allow customers to use the translation feature.

If non-English content is added directly to a page, editors should use the HTML <lang> attribute so screen readers can identify and pronounce the content correctly.

Recommended: Create and maintain content in English whenever possible. Use CT.gov's translation feature to provide translated versions. Only add manually translated content when there is a specific business, legal, or customer service need.

Before adding translated content

The CT.gov language picker automatically translates English content into multiple languages.

Before manually adding translated content to a page, consider:

  • Whether the automated translation feature meets your customers' needs
  • Whether the translated content has been reviewed for accuracy
  • Who will maintain the translated content when the English version changes
  • Whether maintaining separate translations will create additional work over time

Manually translated content is maintained separately from CT.gov's automated translation feature.

When manually translated content may be appropriate

Examples include:

  • Legally required translated text
  • Program materials that have been professionally translated
  • Approved phrases that require specific wording
  • Multilingual contact information
  • Common greetings, titles, or instructions provided in another language

Whenever non-English text appears on a page, use the <lang> attribute to identify the language.

Why the <lang> attribute matters

Screen readers use language information to determine how text should be pronounced.

When non-English content is not identified with a <lang> attribute, assistive technologies may attempt to read the text using English pronunciation rules. This can make content difficult or impossible for customers to understand.

Using the <lang> attribute helps ensure non-English content is announced correctly.

Where editors can add <lang> attributes

Editors can add <lang> attributes anywhere they can edit HTML within a rich text field, including:

  • Knowledge Base articles
  • Component description fields that use rich text
  • Legacy pages that use rich text fields

Fields that do not support rich text editing do not support HTML attributes.

How to add a <lang> attribute

  1. Open the Rich Text Editor.
  2. Select the HTML tab at the bottom of the editor.
  3. Locate or add the non-English text.
  4. Wrap the text in an HTML element that includes the appropriate language code.
  5. Click Accept and save your changes.
Rich Text Editor with the HTML tab selected, showing a Spanish example and highlighting lang="es" 

Examples

Spanish

<span lang="es">¿Qué es la cobertura posparto estatal?</span>

French

<p lang="fr">Bonjour, voici votre guide.</p>

Entire section in another language

<div lang="es">
  <h2>Información importante</h2>
  <p>Este programa ofrece ayuda a las familias elegibles.</p>
</div>

In these examples:

  • es identifies Spanish content
  • fr identifies French content
  • Screen readers use this information to apply the correct pronunciation rules

Choosing the correct language code

The <lang> attribute uses ISO 639-1 two-letter language codes.

Language Code
Spanish es
French fr
German de
Chinese zh
Arabic ar
Portuguese pt

A complete list of language codes is available from the ISO 639-1 two-letter language codes (Library of Congress).

How manual translations interact with the language picker

The CT.gov language picker translates English source content.

Manually added translations are not connected to the automated translation process. When a customer changes the language using the language picker:

  • Manually translated content remains unchanged
  • Automated translations are generated from the English source content
  • Differences between manual and automated translations are expected

For this reason, manually translated content should only be added when there is a clear business need.

How the Digital Accessibility Team helps

  • Provide guidance on when to use the <lang> attribute
  • Review pages that contain multiple languages
  • Assist with accessibility questions related to translated content
  • Support alignment with CT.gov accessibility standards

Related resources

Contact

For accessibility questions: dgoeaccessibility@ct.gov

For Sitecore support, submit a ticket through the BITS Service Portal.

Content Editor