-
Notifications
You must be signed in to change notification settings - Fork 1
Step‐by‐step: Managing Multilingual Support in Drupal
Sarah Jones edited this page May 23, 2025
·
3 revisions
This is here to document how translation was set up to provide context for any future additions or changes.
-
Enable Required Core Modules
Start by enabling the Configuration Translation and Content Translation core modules by running:
./vendor/bin/drush en content_translation config_translation -y. -
Update the Database and Clear Cache
./vendor/bin/drush updatedb ./vendor/bin/drush cr -
Add a Second Language (e.g. Spanish)
- Go to: Configuration → Regional and language → Languages
- Click Add language, choose Spanish, and save.
-
Add a Language Switcher to Your Site
- Go to: Structure → Block layout
- In the Header section, click Place block
- Search for Language switcher
- Click Place block
- Uncheck Display title
- Click Save block
- Drag it to appear just below the Summit navigation
-
Edit Language Display Names
- Go to: Configuration → Regional and language → Languages
- Click Edit next to a language to customize its name (e.g. “Español”).
- Language names should always be displayed either as standardized language codes (e.g. en, es, fr) or in their native form (e.g. English, Español, Français).
-
Set Up Language Detection and Selection
- Go to: Configuration → Regional and language → Languages → Detection and selection tab
- Click Enable URL (e.g. /en, /es)
- Ensure Interface detection is enabled (needed for language switcher and system messages like 404s)
-
Configure Content Language and Translation
- Go to: Configuration → Regional and language → Content language and translation
- Check the Content box
- A new table will appear. Enable translation for specific content types like Articles
- Repeat for all content types you want to be translatable
- You should also enable translation for Custom menu links, Media (like alt text), and other fieldable entities.
-
Edit Menus for Translation
- Go to: Structure → Menus
- Edit a menu and enable translation for its links
- You can now provide translated titles per menu item
-
Review Field-Level Translation
- Go to: Structure → Content types → Select a type (e.g. Article) → Manage fields
- You should now see a checkbox: “Users can translate this field”
- Make sure it's checked for the fields you want to make translatable.
-
Translate Views
- Go to: Structure → Views
- Click a view (e.g. “Summit Speakers”)
- Click the Translate tab
- Navigate through:
- Displays → Your display (e.g. “2024 speakers”)
- Display settings → Edit Display title, etc.
-
Make URL Aliases Language Neutral
- Go to: Configuration → Search and metadata → URL aliases
- Click edit on each alias and select "language" "None"
- This means that when navigating the urls remain intact acros languages and don't revert to pointing to node values.
-
Twig File Internal Links
- Make sure all Twig file internal links are specified as nodes instead of hardcoded relative URLs to keep the language selection across page navigation
- To find the node number you can navigate to that page and click 'edit' to see what node number appears in the url bar
-
Add Interface Translations for Twig Strings
- Make sure Twig files only include date formats that support translation
- Replace hardcoded strings in Twig files with the translation filter:
{{ 'Join our mailing list'|t }} - Then clear cache:
./vendor/bin/drush cr - Visit the page in Spanish
- Go to: Configuration → Regional and language → User interface translation
- Search for the phrase (e.g. “Join our mailing list”)
- Add the Spanish translation and click Save
-
Translate Dates
- Go to: Configuration → Regional and language → Date and time formats
- Ensure that date formats (e.g. for articles) are translated appropriately for Spanish.
- When translating a piece of content, add in the language abbreviation to that content title. This applies for all content except for pages and articles that use the content title directly, in which case translate the entire title. For example
Text block - Introshould have the nameText block - ES introfor a Spanish translation. This is to make it easier to identify which content item is for which language.
- Home
- Recurring tasks
- Local site development
- State of interledger.org
- One-time setup notes
- Managing Multilingual Support