Problem/Motivation

In Drupal 7, the language names in the language list show up as localized to their native names. In Drupal 8 native names don't exist anymore as a concept, however language names are translated to any other language just as well as any other configuration entity.

We should provide the ability of configuring the language switcher block to use the current language name, the localized language name or language codes (which is a common request), and provide ways of extend this from contrib (languageicons, lang_dropdown, I'm looking at you)

Proposed resolution

- Make the block configurable for showing language codes or language name.
- If locale is enabled, make the block configurable for showing language name or localized language name.
- Make the display configurable between this behavior and others that could be provided by contrib, so we only have one configurable "Language switcher block" instead of confusing multiple ones.

Remaining tasks

User interface changes

- New setting in the block configuration for language switchers
- Display of language switcher changes based on configuration.

API changes

None.

#2797961: Language switcher label cannot be changed for English

Comments

penyaskito’s picture

Gábor Hojtsy’s picture

Issue tags: -sprint +language-base

Move off sprint, add base tag.

Gábor Hojtsy’s picture

What kind of configuration you had in mind here?

penyaskito’s picture

Allow to select if we want to display language code, language name, or language native name.

Also allow others to hook, so we only have a language switcher block instead of having multiples if contrib needs to provide more, as this confuses sitebuilders when deciding which one to use.

Gábor Hojtsy’s picture

Ah that makes sense, yup. Looks like this was even in the issue summary but I did not pay enough attention :/

Gábor Hojtsy’s picture

Status: Postponed » Active

Active again.

Gábor Hojtsy’s picture

Version: 8.0.x-dev » 8.1.x-dev

Assume this may be possible in 8.1.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ABaier’s picture

I double the request, since this is really a common use case.

Another great option would be the possibility to place the links of the language switcher to a menu of choice somehow, instead of printing them in a separate block. I did not find a solution for this, so far.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Anybody’s picture

I agree this is still a relevant requirement. Alternatively it might make sense to simply add a "Language Display Name" or "Language Switcher Display Name" value to the Language configuration. This would be very flexible and also allows to solve edge-cases. This additional config value would be placed at admin/config/regional/language/edit/XX and default to the current display language.

Or in other words: You often do not want to rename the general (system) language name e.g. "Czech" in the system languages list, but want to set a custom display name for the frontend & language switcher. This would also fix cases where you want a different shorthand (while the language code is hard coded and can not be changed), want a region prefix like DE-de or whatever. And you could translate it into each language.

I guess that would be a lot more flexible, powerful but even simpler than the old switch logic!

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Anybody’s picture

Issue summary: View changes

This issue is supposed to fix the current core bug at: #2797961: Language switcher label cannot be changed for English

sakthi_dev’s picture

Status: Active » Needs review

The issue is not reproducible in Drupal10. Tried to reproduce but found it works as expected listed down the steps followed.
1. In a Vanilla Drupal, installed the Drupal in German.
2. Added English under Language (/admin/config/regional/language).
3. Installed the Configuration Translation module.
4. Translated the Language->English Configuration with required value.
5. Got the expected result after placing the language switcher block.
Please let me know if I'm doing wrong.

sakthi_dev’s picture

Status: Needs review » Active