Change language names in language switcher (English > En)

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by criscom on December 9, 2012 at 10:04am

I'd like to change the language names in the language switcher. Currently, it says "Deutsch English" on my site.
I want it to be "De En".
I have been searching for a solution but couldn't find any except this: http://drupal.org/node/313814

Seems like overkill. Isn't there an easier less complex approach? Thanks.
Chris

Categories:

Comments

You could change the language

Posted by no2e on December 9, 2012 at 6:32pm

You could change the language names in /admin/config/regional/language (click at "Edit").

As easy as that, thanks.

Posted by criscom on December 9, 2012 at 6:48pm

As easy as that, thanks. That's it. Thanks a lot!

Hey It was vary easy Thank

Posted by cas.priyanka on February 12, 2013 at 8:39am

Hey It was vary easy Thank you no2e

So simple !

Posted by TWD on May 23, 2013 at 8:54am

So simple !

This is not the way to go and

Posted by gagarine on July 31, 2017 at 9:40pm

This is not the way to go and it doesn't works with recent D8.

Instead add this code in your theme:

<?php
/**
* Use language code for the language switcher
*
* @param $variables
*/
function MYTHEME_preprocess_links__language_block(&$variables) {

foreach (
$variables['links'] as $i => $link) {
// @var \Drupal\language\Entity\ConfigurableLanguage $linkLanguage
$linkLanguage = $link['link']['#options']['language'];
$variables['links'][$i]['link']['#title'] = $linkLanguage->get('id');
}
}
?>

Unfortunately, still valid.

Posted by isagarjadhav on December 15, 2020 at 6:11am

Its been 3 years but unfortunately still this is the only solution. This thing could have been easily managed via CMS.

WEB DEVELOPER

It works

Posted by Ralf Eisler on December 30, 2017 at 10:27am

@gagarine Thanks!

Internationalization

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /