Language negotiation implemented

Two posts back I was writing about my plans to implement language negotiation for getgnulinux.org. I’m happy to announce that its implementation was completed today.

“Language negotiation is a function of the HTTP protocol which lets a server choose among several language versions of a page, based on the URL and on preference information sent by the browser (specifically in the Accept-Language header).” – http://www.w3.org/International/questions/qa-when-lang-neg

Before language negotiation was implemented, http://getgnulinux.org/ would always bring the visitor to the website in its default language (i.e. English). Now, when the language preferences are properly set in the visitor’s web browser and the website is available in one of the preferred languages, the website will automatically display the page in the visitor’s preferred language. It will only do this for languages for which the translation is complete (at the time of writing this, these are Hebrew and Asturian). This was a conscious design decision – it wouldn’t be very nice to display a page which is only partly translated.

Other changes came along with the implementation of language negotiation. The language menu on the top of each page now only shows the languages for which the translation is complete. Incomplete translations are still accessible from the “More languages” item in the language menu. This link brings the user to the new language selection page which gives an overview of all translations and their status.

The implementation of language negotiation was actually very simple. Language negotiation is a common feature for websites which means that there is a good chance that someone has already written freely available code for it. And indeed, someone has. There is HTTP::negotiateLanguage from PEAR, PHP’s own structured library of code. However, I used a modified version of that function which I got from Matthew Somerville’s website. The reason I chose Somerville’s version is because apparently PEAR’s version fails on one criterion (see Somerville’s page for details). This also allowed me to adapt some code to GGL’s code which made implementation even easier.

Poll: How could getgnulinux.org be improved?

How could GetGNULinux.org be improved? The website has undergone some changes in the last few months, but I bet there is still enough room for improvement. I’d like to know what you think could improve GetGNULinux.org.

If you choose “better layout” or “better content”, please specify in the comments what exactly could be better.

Flag as a symbol of language – not a good idea

While working on the GetGNULinux.org project in June 2011, I decided to update the look of the website as I wasn’t very satisfied with it. It just wasn’t very nice on the eye and I’m not easily satisfied. One of the things I thought definitely needed a face-lift was the language menu. One of the changes I made was anchoring images of country flags to the language links in the language menu. I mainly did this because I thought it looked nice and because it could make it easier for someone to select the preferred language (the flag of your own country is very recognizable). But I recently realized that this wasn’t such a good idea.

This decision has given some issues. For example, GetGNULinux.org is written in English, American English to be more specific. But from the start I’ve been using the flag of the United Kingdom for the English language. This obviously doesn’t make sense. I later changed this to the flag of the United States. This however doesn’t solve the problem, as I later found out.

Last week I got an email from a translator who explained that I was using the wrong flag for the Catalan language. Fact is that I was using the flag for Andorra for the Catalan language. According to Wikipedia, “Catalan [is] the national and only official language of Andorra and a co-official language in the Spanish autonomous communities of Catalonia.” So which flag should be used to link to the Catalan language: the flag for Andorra or the Catalonian flag? I was later told by a Catalan translator that the Catalonian flag should be used to refer to the Catalan language, for historical reasons and because it was used more often. So I changed it.

To get back to the issue with the “English flag”. I still wasn’t sure whether this use of the UK or USA flag for the English language was correct. So I googled “flags language” and the first result read: “Why you should not use a flag as a symbol of language”. This of course drew my attention, so I clicked on that link which brought me to an article with the title “Flag as a symbol of language – stupidity or insult?“. It is a very well written article which explains the issue very clearly. To keep things short: a flag is a symbol of a country, not a language. And there is no reason to bind the country and the language strictly together.

“Why should, for example, a Brasilian select the flag of Portugal to select his native language? It’s quite possible that a Brasilian does not even know the flag of Portugal.” – http://www.cs.tut.fi/~jkorpela/flags.html

Hence the use of flags to refer to languages doesn’t make sense. So today I followed the advice from that article and I removed all flags from the language menu of GetGNULinux.org.

But it doesn’t stop there. On that same website I found a section “Techniques for multilingual Web sites” with more useful documents from the same author. I took more advice from those documents in order to optimize GetGNULinux.org. For example, the language menu has been moved to the bottom of the documents in order to emphasize the content at the beginning of a page in indexing. And language negotiation is something I wanted to make use of for some time now, and this is something those documents also cover. So this is something I’ll work on in the near future.

Asturian translation completed

With just two months passed since the completion of the Hebrew translation, another language can be added to the list of completed translations for GetGNULinux.org. I’m very happy to announce that the Asturian translation is now online! Many thanks to the Softastur translators team, and especially to their member Iñigo Varela who took the translation to Asturian upon himself. At first I was skeptic when he told me via email that he could do the translation in one or two days. Imagine how surprised I was when I got an email from him the very next day, with the words: “All translations done!”

In fact, Iñigo did the translation of getgnulinux.org in collaboration with Marcos Costales  (from Softastur) back in 2009. But the getgnulinux.org project was stalled and Iñigo and Marcos decided not to wait longer. Marcos downloaded the structure of getgnulinux.org, Iñigo translated the .html files, and they hosted it at faiteconlinux.softastur.org in collaboration with Mikel González (also from Softastur).

Last week I noticed visitors coming from that website which brought me to their Asturian version of GetGNULinux. I was very surprised to find a fully translated GetGNULinux in a language I, at that point, never even heard of. What’s even stranger, is that there were no traces of translation files for Asturian to be found in the original GGL repository (but that makes sense now, knowing that the .html files were translated manually). So I contacted the Softastur translators team who responded very quickly. Iñigo offered to translate it again using Transifex, Mikel provided an icon of the Asturian flag, and the next day there was http://getgnulinux.org/ast/.

This is yet another big step forward in encouraging more people to try Linux. More translations coming soon (I hope)!