Your opinion to this page?
Deutsch Deutsch English English

If you expect visitors from different countries on your pages, you probably might offer some content in different languages. This article explains in 5 steps how I created this comfortable web site, where the user gets pages delivered in his preferred language as often as possible. (OK, we only have english and german pages here.) 

The software used here is still in alpha state, so in case you find bugs I kindly ask you to send me an email.

Step 1 - Define the language of each page

If Website Baker does not know which language a page has, it can't help with multilingual support. For this reason we have a field called Language in the Settings for each page in the backend, which must be set with the correct value.

Step 2 - Offer links to other languages

The easiest method is to put links to the home pages of the different languages into the template. This gives the visitor a way to change the language. It is not very comfortable, though, because he has to traverse the menu again until he reaches the content where he was in the previous language.

It is possible to use this behaviour with a default installation of WB 2.7. I even think that there are some templates available for download somewhere which already have included it.

Step 3 - Offer links to the current content in other languages

This solution is much more comfortable. It is even possible to integrate it into static web sites which use no CMS at all. But the larger the site grows, the more work you have to manually administer the menus.

Website Baker does not include such a functionality in version 2.7, yet, but you can expand it. I wrote the code snippet Easy Multilanguage Link. Using it requires some spiritedness, because you need to make some minor changes in the kernel. Those are necessary to add another field to the page settings. I called it Page Code. For all pages with the same content you now enter not only the correct language, but also the same page code (some string of your choice). Add one line of code into your template and now you always deliver links to pages with the same content, but in other languages.

I think the visitor will enjoy it.

Step 4 - Deliver home page in the preferred language of the user

It is possible to offer this functionality even on static pages. In fact, I already did it 10 years ago with a little Perl script. The user can set his preferred language in the settings of his browser. The server side script can evaluate this setting and decide to deliver in the best fitting of the available languages. If no language does fit, the script will just use the default language of the site.

By default Website Baker does not offer such a functionality. But when Easy Multilanguage Link is already installed, one just needs to add some more code and either change httpd.conf or another kernel file of Website Baker, and ready is the automagical language switch for the home page. Website Baker extensively makes use of browser Redirects, my solution has no need to go on such detours. It just delivers the content in the preferred language.

Step 5 - Deluxe version: Deliver all links coming from external in the preferred language of the user

When a visitor comes from an external link, which is linking to a page which exists in different languages, it would be great for him to get the page delivered in his preferred language, right?

For instance, you did follow a link to the german version of this article, but your browser tells my server that you prefer english, so why should the server not deliver the english version instead of the german the link points to? (Microsoft does it with it's KB articles, for instance.)
Of course, one should not play this game when the user already visits the site, because otherwise he would not be able at all to change the language within WB. And of course we need no browser redirects, which would be a waste of ressources here (but they have their right to exist in other cases).

Website Baker is only able to behave in such a comfortable way after some kernel files have been changed.

Conclusion

I did implement the functionality introduced above for this site http://wbdemo.heysoft.de/.

Because the majority of users in the forum decline unauthorized changes in core files (and because the code is still alpha), I will abstain from publishing the source code for now.

I am sorry that the developers team of Website Baker did decide not to include multilingual support with version 2.8. You need to wait until version 2.9, or install Easy Multilanguage Link with the included patches to solve the first three steps from above.