Skip to main content

Admin toolbar should always be rendered in the admin language (if set)

When you are working on a multi language website you want to keep your admin toolbar always in your preferred language. Usually (especially if you are the developer), you do not want the Admin Toolbar to change language every time you are on the translated page of something.

Here are the steps you have to follow for keeping your admin toolbar same while switching between languages.

1. Go to https://www.drupal.org/project/drupal/issues/2313309 and apply the patch

 "extra": {
        "patches": {
            "drupal/core" : {
                "Admin toolbar should always be rendered in the admin language (if set)": "https://www.drupal.org/files/issues/2023-03-09/2313309-162_0.patch"
            }
        }, . . . .

In case you do not have already installed cweagans/composer-patches you can install this with composer

composer require cweagans/composer-patches

and then for applying the patch

composer install

2. Go to user/1/edit or the user you want to apply the permanent language for the admin toolbar and find the Language Settings field group and select the desired language from the available language.

That's it. No go to a node page with translation for example and verify that the admin toolbar has not the current (translation) language.

translation admin toolbar