- Issue created by @manarak
- 🇩🇪Germany FeyP
Thanks for filing this issue.
We don't actually provide the titles of the links in the module. The module uses the links (including the link title) from Drupal Core's language switcher and makes them available for display as menu links.
If you want to change the language switch links, including the link titles, there are a bunch of contributed modules available that you should be able to install in addition to this module that allow for various alterations of the language switch links. Alternatively, you can use hook_language_switch_links_alter() in a custom module.
For your specific request, there is also an example in the FAQ on the project page that I think does exactly what you asked for by just changing a template file in your theme.
- 🇹ðŸ‡Thailand manarak
Thank you for your very fast reply.
I wouldn't want to do this via template, because menus are used in several places on the site, and it's in general less scalable than a preprocess function or similar.
The problem is, neither menu preprocess nor the hook you mentioned seem to work.
I have tried different things in the theme's .theme file, such as
function mytheme_language_switch_links_alter(array &$links) { if (isset($links['en']['link'])) { $links['en']['link']['#title']->setLinkTitle('en'); } }
or
function mytheme_language_switch_links_alter(array &$links) { if (isset($links['en']['link']['#title'])) { $links['en']['link']['#title'] = 'en'; } }
and none seems to work
- 🇮🇳India rohit-rajput-sahab Uttam Nagar, Delhi
Hi DrupalDope,
Use this patch
https://www.drupal.org/files/issues/2022-07-12/language-icons-not-workin... →