Jump to content

How-To use different languages for different users (or different domains)


bernhard
 Share

Recommended Posts

Imagine you have a multisite setup where you need different languages for different domains: One website might be single-language (DE only), another one might need DE/EN/CZ, and another one might need DE/EN/HU:

yHZz2iO.png

I didn't know how to do it, and I didn't find any other posts with a similar need or solution. When looking into the code I even thought that my need was not possible yet without modifying a core file. So I asked Ryan if he was willing to make the process of adding languages to the $languages array hookable.

Turns out that this is not necessary! All you have to do is to grab the Iterator of the languages array and remove languages as you need:

// /site/ready.php

if($anyCondition) {
  // remove CZ language
  $languages->getIterator()->remove("name=cz");
}

0W3X5Ya.png

 So simple 😍 Maybe it helps 🙂 

  • Like 2
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...