MODX Community

Multi language site with Babel not return to default language

Hello all,
i testing with a multiple language site made with Babel and it works almost perfect.
From another language back to default wil nog work and i see the problem.

Tree languages

1 nl (dutch) default > modxcloud.com works not because of the nl extension
2 de (german) > modxcloud/de/ works fine
3 en (englisch) > modxcloud/en/ works fine

If i go to german and then back to Dutch there in a /nl/ in the url and thats not good.
I post a image where you can see the problem

afb
Does anyone knows the solution?

link to test site:
http://c0296.paas1.ams.modxcloud.com/
Stefan

Hi @stefonline

Long time no see. Welcome back!
Are you using any context router? You will need one.

Have a look on XRouting. You can find here a great article about that.

Cheers and good luck.
If you need more help, just ping us again :wink:

Hi jnogueira,

I have installed Xrouting but then the /en/ will not work. When i disable Xrouting /en/ wil work but not the dutch. I will enable Xrouting and try to make it work.

Thanks

I have a question, its not clear to me
If i use Xrouting do i have also to use a gatewaySwitch? Or use one of them?
i folow this tutorial:
https://www.inside-creative.com/research-and-development/2018/10/30/creating-multilingual-modx-websites-using-babel/

Great! :wink:
Don’t forget to configure your contexts settings. This is important. if you are in a blocking point, please ping me here and I will share with you my current config so you can cross check :wink:

One note: No need to change the htaccess file for a multi-language site. I strongly suggest to keep it as it is, otherwise you will be creating complexity issues.

Cheers

No need to use a gateway, as XRouting has a default context that will be used when none is selected.
XRouting is the Gateway basically.

On the shared tutorial, do not consider htaccess changes and Language Router snippet.

Sharing my config so you can have a guidance.

I have 3 contexts:
web (serving as browser language detector and redirector)
pt
en
fr

Config for the “pt” context:

http_host: www.yourdomain.com
site_url: https://www.yourdomain.com/pt/

Same will apply to the remaining contexts.
Note: You can reserve web Context to be used as browser language detector and redirector. I am doing this and will redirect the visitor to the context matching the browser language. If you don’t want this, you can simply use it as a language like any other context, or create a basic landing page where the visitor will pick a language as a starting point. Just an idea :slight_smile:

My current XRouting settings:

As you defined previously the different home page IDs for each context, please do not forget to link the homepages in Babel.

This should be working correctly for you as well :slight_smile:

Please ping us again if more help needed :wink:

@jnogueira I will check everthing again and if nu succes i will send you the manager login.
Thanks for the help
Stefan

1 Like

Another important detail:
On the HTML head, please ensure that you also have this tag:

<base href="[[!++site_url]]" />

@jnogueira Thanks a lot!!! Its works now!
in your example i see i18n Code and Locale pt_TUTF8 whats this?

Stefan

Glad you have it working! :slight_smile:

Locale having pt_PT.UTF8 is the language code + the char encoding. This is related with php locale for date and time formating. On a multi language site with date timestamps you might need it, specially if you have dates showing like this:
21st of January 2020, 21:50
Then when changing context to PT:
21 de Janeiro de 2020, 21:50

This will be done automatically when using modx date output filters.

Cheers!