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

Comments
You could change the language
You could change the language names in
/admin/config/regional/language(click at "Edit").As easy as that, thanks.
As easy as that, thanks. That's it. Thanks a lot!
Hey It was vary easy Thank
Hey It was vary easy Thank you no2e
So simple !
So simple !
This is not the way to go and
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.
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
@gagarine Thanks!