Babel - two different context with same language


I’m using Babel in our multilingual site and everything is running smoothly with seven languages. URL structure: subdomain e.g. www.*****.com/en/.

I encountered a problem, when i need to create site for India region with english language also. We already have english as a default language in web-context.

I tried create new Indian context with following settings.
base_url → in
cultureKey → en

That didn’t work, I guess i can’t use ‘en’ as an cultureKey since it’s already use in web-context. And base_url and cultureKey should be same in Context?

Is there a way to create with Babel two different context with same language?

I don’t think this is a requirement of Babel.

What do you use as the router plugin to switch to the correct context.
Maybe the router plugin requires base_url and cultureKey to be the same.

It is possible with XRouting. You need a different base_url for every context.

Hi, Thanks.
The main problem is to use same cultureKey (en) in two context? How to define language (cultureKey) in Indian context, if en is already in use in web-context? So basically i need multi-regional pages instead of multi-lingual. Maybe it’s not possible with babel?

The same cultureKey shouldn’t be a problem for babel. You can set up context groups in babel’s babel.contextKeys setting by putting a semi-colon between e.g.:


Are Context groups only in MODX3? I’m still using 2.8.

That works in 2.x too Babel - Babel | MODX Documentation

Keep in mind that Babel pretty much only handles the linking between resources on different contexts. As for loading the page, it’s up to your router plugin e.g. XRouting as Jako mentioned above - make sure each base_url is unique.

I’m using babelContextRouter.

I grouped contexts with semi-colon. Now context after the semi-colon doesn’t show in babelLinks lang selector.

I need to study the Babel & Routers more. It’s been long time since i last made changes to this setup.
Thanks again.

Ah, This one?

It appears to also require you to use language-specific Apache/NGINX rewrites (whereas XRouting doesn’t need that)

In terms of the context groups, yeah I think it’s typically meant for having different locations/sites with multiple languages in each. So perhaps that’s not quite your use case…

Can you try using a different cultureKey for the second English language context? e.g. in-en or something along those lines? You’d need to update your rewrite rules to accommodate that too.