General developer forum

Customizing the Language Dropdown Menu Selections

 
Picture of L Passaglia
Customizing the Language Dropdown Menu Selections
 

Hello,

Is there a way to customize the options displayed in the Language Dropdown Menu, i.e.: to remove the language identifiers as in "English (en)" to only display "English"?

Thank you

 
Average of ratings: -
Picture of L Passaglia
Re: Customizing the Language Dropdown Menu Selections
 

So there are no ways to achieve the above? Or is it so simple that my request is downright ridiculous? Anyone? I'm running the Essential theme on Moodle 3.3.

 
Average of ratings: -
Picture of Richard Oelmann
Re: Customizing the Language Dropdown Menu Selections
Core developersParticularly helpful MoodlersPlugin developersTesters

Have you looked at the customise language featured? What does it say in the language string that is being called? 

 
Average of ratings: -
Picture of L Passaglia
Re: Customizing the Language Dropdown Menu Selections
 

Hello Richard,

Thanks for the reply, but could you be a little more specific. Which customise language feature are you referring to and where can I find it?

 
Average of ratings: -
Picture of L Passaglia
Re: Customizing the Language Dropdown Menu Selections
 

I'm I the only one who wants to remove the (en) and the likes from the Language Dropdown Menu selections? Is there any way to customize those menu selections?

 
Average of ratings: -
Picture of Mike Churchward
Re: Customizing the Language Dropdown Menu Selections
Core developersParticularly helpful MoodlersPlugin developersPlugins guardiansTesters

As far as I can see, that is hardcoded in Moodle core. See the 'get_list_of_translations' function in '/lib/classes/string_manager_standard.php'. The language code is always included in parentheses after the language name.

 
Average of ratings: -
Picture of L Passaglia
Re: Customizing the Language Dropdown Menu Selections
 

Thank you for your reply Mike. I'll take a look!

Very much appreciated!!

 
Average of ratings: -
Picture of Fernando Acedo
Re: Customizing the Language Dropdown Menu Selections
Particularly helpful MoodlersPlugin developersTesters

Yes, you can but you must create a renderer to modify get_list_of_translations.

I developed one some years ago to display only the 2-digits code (EN, FR, DE, ES) but it is not easy due the wrong languages names used.

Other option that we use often when adding Spanish that moodle shows as Spanish International (I never seen English or German International) is to rename the strings in Custom Strings.

This is a pending task from moodle because is using a very old array that could be modified to add two items in the array: the description and the code.

 
Average of ratings: -
Picture of L Passaglia
Re: Customizing the Language Dropdown Menu Selections
 

Very good information!

Thank you very much Fernando!!

 
Average of ratings: -