Elxis CMS Forum

Support => Elxis 4.x/5.x DEV => Topic started by: seadhna on October 18, 2020, 18:09:10

Title: Show full language name instead of ISO code in language switcher (FIVE template)
Post by: seadhna on October 18, 2020, 18:09:10
Hi, is it possible in the select-box of the language-switcher in the FIVE template, to display the full language names, instead of the 2-letter ISO code? e.g. English instead of EN?
Title: Re: Show full language name instead of ISO code in language switcher (FIVE template)
Post by: michalis1984 on October 19, 2020, 12:36:11
Did you try to change the settings on the language module?
Title: Re: Show full language name instead of ISO code in language switcher (FIVE template)
Post by: seadhna on October 20, 2020, 17:17:33
In the FIVE template, the language module is not required. There is a parameter in the Template settings: "Display language selection? Available only if 2 or more languages are published".
This is better because it allows switching languages on tag index pages.
Title: Re: Show full language name instead of ISO code in language switcher (FIVE template)
Post by: michalis1984 on October 20, 2020, 18:30:44
Correct. It needs a change at template level at file five.class.php
Title: Re: Show full language name instead of ISO code in language switcher (FIVE template)
Post by: datahell on October 20, 2020, 21:56:57
Template Five uses an internal language selector and not the module. The template is designed to use the 2 letter language code in order to fit properly on the available space under all circumstances. I advise you not to change it.

However if you want to change here is how to do it.
Open file templates/five/includes/five.class.php
Go to line 353:
$block_lang .= '<option value="'.$lng.'"'.$selected.' data-act="'.$link.'">'.strtoupper($lng)."</option>\n";
And change it to:
$block_lang .= '<option value="'.$lng.'"'.$selected.' data-act="'.$link.'">'.$info['NAME']."</option>\n";

If you want to display the English language names instead of the native ones then instead of $info['NAME'] use $info['NAME_ENG']
Title: Re: Show full language name instead of ISO code in language switcher (FIVE template)
Post by: seadhna on October 22, 2020, 16:05:37
Thanks datahell!