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.
Related Issues
#2797961: Language switcher label cannot be changed for English
Comments
Comment #1
penyaskitoPostponed on #2107427: Regression: Language names should display in their native names in the language switcher block
Comment #2
Gábor HojtsyMove off sprint, add base tag.
Comment #3
Gábor HojtsyWhat kind of configuration you had in mind here?
Comment #4
penyaskitoAllow 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.
Comment #5
Gábor HojtsyAh that makes sense, yup. Looks like this was even in the issue summary but I did not pay enough attention :/
Comment #6
Gábor HojtsyActive again.
Comment #7
Gábor HojtsyAssume this may be possible in 8.1.
Comment #13
ABaier CreditAttribution: ABaier commentedI 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.
Comment #20
AnybodyI 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!
Comment #25
AnybodyThis issue is supposed to fix the current core bug at: #2797961: Language switcher label cannot be changed for English
Comment #26
sakthi_dev CreditAttribution: sakthi_dev at Specbee for Drupal India Association commentedThe 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.
Comment #27
sakthi_dev CreditAttribution: sakthi_dev at Specbee for Drupal India Association commented