Browser language preferences: navigator.languages is coming

Browsers provide an option to choose the preferred language a website to be shown, often named as “Accept language“.

Firefox accept language preference

These preference values allows websites to deliver a suitable language version to the user.

For the developers, to read this value, the existing options is to check the Accept-Language http header value.  It works and many websites use it already. But this value was never exposed at client side. Javascript cannot access the value of these preferences. There are many use cases where this is preferred. Handling i18n at client side is one of this.

Chrome accept language preference
Chrome accept language preference

navigator.language does exist, but that does not give the correct values. For chrome, it gives browsers UI language and it differs from what is meant by accept-languages. Firefox 5 onwards this property’s value is based on the value of the Accept-Language header value. It returns a string value, but accept-language is usually a list of language values in the order of preference.

The good news is, a patch just landed in Firefox to support navigator.languages

It returns an array of language tags representing the user’s preferred languages, with the most preferred language first.

The most preferred language is the one returned by navigator.language

See specification.

Now that it is landed in Firefox, Blink developers are also considering the implementation.

This will definitely improve the web experience to users and help a lot for internationalization developers.

W3C Workshop at Madrid

I will be speaking at the upcoming W3C workshop at Madrid. The workshop is on 7-8 May 2014 and the theme is “New Horizons for the Multilingual Web”.

I will be co-presenting with Pau Giner, David Chan from Wikimedia Foundation Language engineering team on best practices of translation at wikipedia. It will cover the design (from both technical and user experience perspectives) of the translation tools, and their expected impact on Wikipedia and the Web as a whole.

Mediawiki moves to json based localisation file format

Mediawiki is moving from PHP array based localisation file format to json format.

This is based on the RFC:

A lot of extensions were also migrated to the new localisation format, thanks to Siebrand Mazeland

The json based localization file format was first introduced in our frontend javascript i18n library

If you are interested in seeing some of the sample json files see , claimed as “largest patch set in the history of MediaWiki”