By misqu23 on
Hi
In Language Switcher block I'd like to show iso code of language instead of native language name. For example
- English
- Polski
should become
- en
- pl
Is there any module available which does exactly what I need, or perhaps which hook should I use ?
In addition of core modules I have got also i18n package installed.
Thanks
Marcin
Comments
Please help. Does anybody
Please help.
Does anybody knows how to achieve this.
Martin
OK. I found this. Module
OK. I found this. Module Consistent Language Interface does the thing.
Use the Languages menu
I solved it this way:
Go to Administer > Site configuration > Languages
Then edit each language and you can enter language codes in the first two fields instead of the descriptive names that are there by default.
So no extra modules are needed.
Thanks
This was driving me crazy too....theme overrides, etc....
I only needed to change the native language box....
Drupal 7 language switcher block display iso code - php solution
I didn't find much about this so I post my solution in case it helps someone.
Situation
I want my language switcher block to display the iso code (a 2 letters string) in place of the full language title. For example :
I want
FR - EN - NLIn place of
Français - English - NederlandsSolution
Place this in YOURTHEME/template.php :
Thanks for the legwork on
Thanks for the legwork on this little snippet — I always went with the first solution though it doesn't always seem ideal (e.g. when offering the language selection on the node edit page).
It should be noted, that a common best-practice approach on rewriting strings (the String Override module) doesn't work for this usecase – there seems to be something hardcoded going on.
Some tweaking
Separate language codes with " | " and makes them uppercase
Thanks dude for this (Y)
Thanks dude for this (Y)
You can also just go to;
You can also just go to;
admin/config/regional/language
There you find active languages.
for your languages English and Polski just press edit and change 'the name of the language in your own language'-or something from English to EN and from Polski to PL
that's the fix without changing code
Hey thanks! It worked!
Hey thanks! It worked!
Any setbacks?
admin/config/regional/language
to go to admin/config/regional/language and rename language doesn't work on drupal 8.3 version
i have do this and it works on mytheme.module (mytheme: name of your theme)
mytheme_links__language_block(&$variables) {
$variables['links']['en']['link']['#title'] = 'EN';
$variables['links']['fr']['link']['#title'] = 'FR';
}
Use language code for the language switcher in Drupal 8
A generic solution for D8. Add this code in mytheme.theme.
https://interface-network.com - Interface Network is an action and research technology governance agency.
Error: Call to a member function
With this I get: Error: Call to a member function get() on null in MYTHEME_preprocess_links__language_block()
Some idea about this error?
You will need to rename
You will need to rename "MYTHEME" to your theme name