Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

[SOLVED] Cutomising language names on a multilingual website

Go to End

9 Posts   1127 Views


11 September 2012 at 2:44am Community Member, 22 Posts


I have a website in both English and French and with potentially more languages tomorrow.

Today, the "French" label is used to refer to a language that the people who speak it call "Français". I'm expecting language names to be expressed in the language and script that the people who read and write that language use. I wouldn't expect someone who speaks only Russian to know that "Russian" is the call sign for their language… Rather, I'm expecting "Russian" to be written using the Cyrillic alphabet and reading what the Russians call their language.

So my question is: "where can I modify the language names"? Is it in some configuration file or hardcoded in a source file? Whatever the case, can someone please tell me which file it is?

Thank you.


12 September 2012 at 2:20am Forum Moderator, 1095 Posts

Are you referring to the languagse dropdown in the cms or to a language switcher on the webste?


12 September 2012 at 4:12am Community Member, 22 Posts

Thanks for your reply. I am referring to a language switcher on the actual website.
I am the only content editor for my website and I read both English and French so the back end side of things isn't an issue.


12 September 2012 at 4:39am Forum Moderator, 1095 Posts

Ok, in that case - can you tell us more about the languageswitcher you're using, maybe post the code used to build it, is it an existing module or widget, or do you have a link to the tutorial/docs it came from?


12 September 2012 at 5:41am Community Member, 22 Posts

The website design and template were made by an intern and I don't have much info. But it doesn't look like there's a plugin involved. I've attached the a screen capture of the appropriate code in and a screen capture of its rendition on the website.


13 September 2012 at 12:51am (Last edited: 13 September 2012 12:52am), Forum Moderator, 1095 Posts

$Locale.Nice (in your template) should normally return the languagename based on the current users language. So if you're currently at the English site, you'll get 'English' and 'French'. At the French site, the names should now read 'Anglais' and 'Français'.

If you'd want the names to be in their native form always (English, Français), you should be able to do (haven't tested this):


Don't forget to ?flush=1 after changing your template...


15 September 2012 at 3:18am (Last edited: 15 September 2012 3:19am), Community Member, 22 Posts

$Locale.nice(true) did the trick but the first letter for "Français" is lower case.

I've tried



<% ucfirst($Locale.Nice(true)) %>

but these appear as such on the webpage.

I've read the [url]documentation on templates[/url] but I don't see a way to call a PHP function. Is it possible to do so?


15 September 2012 at 6:47am (Last edited: 15 September 2012 6:49am), Forum Moderator, 1095 Posts

You'll find the list of $common_locales in framework/i18n/i18n.php. The native name for french is indeed lowercase.

I think you can easily define your own (shorter!) list of common locales from your _config.php. Something like:

i18n::$common_locales = array(
      'af_ZA' => array('Afrikaans', 'Afrikaans'),

Go to Top