Internationalization is becoming a common feature for websites. As you may know, we have been adding new languages both on our website and in our VPS control panel.

We sell our services to a global market, so our website needs to be welcoming to everybody. That’s why we wanted to display flags that are appropriate for each country. So for visitors coming from the UK, we display the British flag for the English link, but for visitors from the US we display the American flag. We apply this to other languages and countries as well.

Here are a few of the versions:

This method is not foolproof since we grab the localisation from the browser and not the IP. So, if a user has his or her browser set to en_GB and goes to our site, he or she will see the British flag even if they are physically located in the U.S. This is simply a nice touch recognizing the fact that there is more than one way to spell pajamas (pyjamas).

Our website runs on Symfony2, so we decided to build this functionality as a bundle and, of course, it is open source so anyone needing or wanting to add this functionality to a website can do it easily. We also want to  encourage the community to get involved since I am sure there are more languages that fit this mold.

You can find this bundle on Github at https://github.com/servergrove/ServerGroveLocaleBundle and pull requests are always welcome. The installation guide is available in the bundle’s README along with the documentation.