Create a multilingual Site with Bludit

Post Reply
User avatar
herrdoering
Jr. Bludit
Posts: 2
Joined: Wed Mar 27, 2019 11:05 am

Wed Mar 27, 2019 11:35 am

Hi folks!

I drive a blog in English and German language about my experiences with different kinds of software and how to set it up. From scratch Bludit does not support multilingual sites up to now. So I found an easy solution to this which I'd like to share with you.

In the root of your domain put this snippet of code in a file called index.php:

Code: Select all

<?php
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$accepted = ['de', 'en']; 
$lang = in_array($lang, $accepted) ? $lang : 'en';
header("location: {$lang}/");
?>
Next create two folders, in my case called "de and "en" and put a full installation of Bludit in both of these. When installing from scratch you should have no issues with pathes. if you migrate from a single language setup take care to change the URL of your site in the configuration before moving the installation. Possibly you have to change the rewrite base in your .htaccess file afterwards.

Now with this setup somebody calling your domain will get routed to the subfolder corresponding to the language set in his browser - or to English, if this specific browser language is not available at your site.

Maybe it's helpful for one or another. :-)
Blog: https://herrdoering.de | Fediverse: @herrdoering@fedpi.de
Tox:135365AC4C3DBCFEE08B6198657EF6011950815974B2A85C50D6E9BFFB01C933FE332254878B
User avatar
Jay
Master Bludit
Posts: 59
Joined: Mon Feb 11, 2019 8:41 pm

Wed Mar 27, 2019 1:26 pm

Administering multilanguage websites based on multiple cms instances becomes tiring when their content needs to be dynamic. Adding new language makes it twice that hard in management.

I'd hit for a solution based on 1 instance with all content conditions set in template.

I've been struggling at the beginning with setting all blog posts under a parent page. I had to make a small change in core to allow all page types to be set as parent.

But with this small thingy, creating multilanguage website with 1 bludit instance is possible. It just needs static pages with langs in their URIs, and set them as parent for corresponding child pages so the url structure becomes domain/lang/page
All other controls like translation strings, generating proper menu items and so on are the matter of proper methods used in template. Some of them you already pointed, but I wouldn't force the user to be redirected as he won't be able to change the website's language at all.
User avatar
herrdoering
Jr. Bludit
Posts: 2
Joined: Wed Mar 27, 2019 11:05 am

Wed Mar 27, 2019 4:15 pm

With this little script a user is not forced to one language. Because of having two sites he always can switch. This could be done with language links in the sidebar for example. He is just initially routed.

Yes, you are right. Handling multilang sites is not that easy.

- How to map URLs of different site to each other?
- How to unify slugs - by adding numbers?
- What other parts of the site need to be adjusted (slugs/categories/tags)
- Automated backend translations?!? Or translation help?
- Blog-Articles with German specifics or only German language links will be of no use for English language natives.
- ...

There are so many things to take care of, that for me it seems it could be easier to have two sites. I ask myself the question, what benefits would a deeper integration bring?
Blog: https://herrdoering.de | Fediverse: @herrdoering@fedpi.de
Tox:135365AC4C3DBCFEE08B6198657EF6011950815974B2A85C50D6E9BFFB01C933FE332254878B
User avatar
Jay
Master Bludit
Posts: 59
Joined: Mon Feb 11, 2019 8:41 pm

Wed Mar 27, 2019 6:52 pm

herrdoering wrote:
Wed Mar 27, 2019 4:15 pm
There are so many things to take care of, that for me it seems it could be easier to have two sites. I ask myself the question, what benefits would a deeper integration bring?
It all depends on goals somebody wants to achieve.
But cramming multiple language version under 1 domain is the first question I'd ask.
But there's another, technical but more important one. Is the tool I have chosen the right one being least time, and resource consuming to achieve the goals?

Bludit has many pros, but also cons. The deeper I got with the backend, the more I realised that this tool needs some modifications to get things done.

I doubt that without some tweaks in htaccess and routing the nested instance will work without hassle.
To be honest I didn't think deeply about multilanguage options in bludit. But with my current experience the easiest approach I'd went with is 1 instace per subdomain. And I'd try to base on symlinks as much as I can to make the instances sharing as many core files, as possible. This would make the management a bit easier (user management and switching between instances for example ) and unify all of them.
Post Reply