Multi-lingual interfaces for a website

One of the uni projects I’m doing is a Hotel Management system for “The Blackfish Hotel”, as part of the third-year group project. Part of this is an online booking system, where customers can book rooms in the hotel.

Our “customer”, the manager of the hotel, has asked for the website to have a version in Finnish as well as English, as apparently a large percentage of his customers are from Finland. This posed a challenging problem for us to solve… well… sort of.

Luckily, I have a bit of an idea of how to do this, and I’m not ashamed to say I owe a bit to the development team of MediaWiki for this, since it’s essentially a similar system.

Every bit of text on the interface is given a specific name, which is used as a sort-of message key for a database lookup. On every page load, every message is looked up from the database, and inserted into the correct place on the page, based on the language code. The database table is simple, an ID for a single-column unique identifier, a name, a language code, and the content for the message. A unique index on both language code and the message name ensures there is only one possibility for each message.

The language code is decided based on a number of factors – if a decision cannot be made on one, it will try the next until it succeeds.

Firstly, it will look for a URL parameter containing a language the system knows about. Failing that, it will check cookies sent by the user’s browser, then if the user is logged in it will check their preferences. Failing all that, it’ll just use English.

It’s a crafty little system, which is theoretically capable of expanding to include any language, all that is needed is one change to the global configuration file, and the set of translations.

One thought on “Multi-lingual interfaces for a website

  1. You can translate a website, a theme or an app much easier with the help of a tool such as Working in an organized platform and having different tools to help you is really important.

Comments are closed.