Multiple Locale Website

This week I am experimenting with multiple languages in PHP based websites. The process is of course not so straight forward, so I am documenting some of what I am doing to get a server setup.

I am using GNU’s GETTEXT and Poedit, in order to get these things running you need to prep the server first. Gettext is well supported in PHP, which is why I am going that route.

On my debian server, I must first install gettext. I just installed the package.

apt-get install gettext

If you want to support a specific language, it must be a supported locale in the host OS as well.

In most linux distributions you can get a list of currently installed languages using:

locale -a

If you try and use gettext with a language that is not supported, it will not work.

On debian to install another supported language, it is fairly easy (I like easy) if you run:

dpkg-reconfigure locales

Then just select the locales you want to support and it takes care of the rest. Doing a locale -a again you should see your newly added languages.