Jump to content
Noel Boss

Change default language name

Recommended Posts

Has anyone tried renaming the default language name from "default" to something else like "en" ? Are there unintended side effects or restrictions or anything else to consider?

There is $languages->findNonDefault(); and $languages->getDefault(); that suggest that renaming should be possible without breaking the core, but I suspect, some modules ore maybe even the core are using $languages->find('name=default') or the inverse and thus break things all over the place…

Has anyone pulled this off?

Share this post


Link to post
Share on other sites

Technically I can, directly in the DB… And it also apparently works… But I don't know in how many ways it could break.

Want to rename it, because I want it to be semantically correct and because I don't want to add a new field. I need it to display labels like "en" "de" and I could just use the name to do so instead of adding another field or hardcoding it…

  • Like 1

Share this post


Link to post
Share on other sites

I use the default name and make a substr with only the first two characters.

Works for "de" and "en", but probably not for every language. 😀

  • Like 1

Share this post


Link to post
Share on other sites

As far I can see it is possible to change it in the DB. After a quick research I couldn't find any place where this would cause problems (maybe in 3d party modules?). But still I wouldn't do that.

If you just want the value for the label, why not taking it from the homepage name, representing the language in the url.

foreach ($languages as $l) echo $pages->get(1)->localName($l);

 

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...