Module Development

Concept: Internationalization (i18n) for Drupal 8, 9, 10, and 11

Drupal modules need to ensure that any strings of text they add in code can be localized by Drupal's translation system. When our code creates a new <button> element with the text "Toggle forecast" it needs to be done in a way that would allow changing that text to another string, like "Alternar pronóstico", depending on the user's preferred language.

In this tutorial, we'll:

  • Define the difference between internationalization and localization and how they allow a Drupal site to be translated.
  • Explore the utilities available to module developers to ensure that the user interface strings in their code are translatable.

By the end of this tutorial, you should be able to explain how and why to internationalize the code in your Drupal modules.

Drupal Module Developer Guide