Parsel: A Mint Plug-in to Detect Language · 323 words posted 09/07/2005 10:24 AM

IMPORTANT UPDATE 01/26/2007: I’ve updated Parsel to support Mint 1.29. You can grab the new version on google code.
Do you ever wonder which language your site visitors use? Meet Parsel, a plug-in for Mint, Shaun Inman’s web statistics application.
What Parsel Does:
Parsel grabs HTTP_ACCEPT_LANGUAGE from the browser’s user agent string and saves it in the Mint database. You can view languages by most recent and most common.
How to Install Parsel
- Download the zip.
- Unzip the file to your desktop and follow the instructions in the READ ME file.
Limitations
I have tested Parsel with Mint v100, v102, v104, v106, v107, v108, v109.The current version of Parsel requires Mint v111-v114..Parsel outputs the raw value of HTTP_ACCEPT_LANGUAGE.Parsel now outputs human friendly language listings. Also, Parsel doesn’t attempt to reconcile slightly different strings. For example, Parsel doesn’t recognize “en-us” as the same as “en-us,en;q.”- I’ve tested this plug-in, but you install it at your own risk. If you’re a PHP programmer, please feel free to look at the source code before installing.
If you have any suggestions or find any bugs, please post them in this thread. I’ll post a tutorial later today for writing your own simple plug-in.
UPDATE 7:23PM EST

I’ve updated Parsel to v0.0.2. Parsel now displays “human friendly” languages like “Spanish-Argentina” instead of “es-ar.” Grab the zip file and unzip it to your desktop. The files include a READ ME that gives quick and easy steps for installing from scratch or updating.
UPDATE 09/09/05 Noon EST
I’ve updated Parsel to v0.0.5. I’ve added to the list of supported languages and tweaked the database to prohibit nulls. If you’re upgrading from an older version of Parsle, please uninstall first.
UPDATE 09/12/05 9:43AM EST
I’ve updated Parsel to v0.0.8.
UPDATE 10/04/05 7:05PM EST
Parsel updated to support showing aggregates as percents.
If you encounter any problems, feel free to post them here in the comments. Thanks.
* * *
3. On Sep 7, 06:19 PM Jeff Croft said:
Sweet! It works great! I agree with Matt, though—we need that human-friendly output. :)
Awesome job! #
5. On Sep 7, 07:40 PM Jeff Croft said:
Marc-
Great! I checked it out. It’s certainly well on it’s way, but I want to show you what I’m seeing. I’ll e-mail you a screenshot. Basically, I’m getting some languages repeated in slight variations, like this:
English (United States), English, q53
English (United States)45
English33
There may be nothing you can do about this, but I thought I’d point it out anyway.
Again, great work! #
6. On Sep 7, 08:35 PM since1968 said:
Thanks Jeff. I get the same thing. It’s a question of how much it’s worth it to clean up what a user’s browser says. For instance, a US install of Firefox by default supports both en-us AND en, which is what you see in the first line you posted above. This generates a different result from a browser that supports only en-us, which is what appears on the second line.
If enough people are interested in the extension, I could see adding a preference, something like “group similar languages (exclude localization).” #


1. On Sep 7, 12:22 PM MT said:
Nice work!
Keep working on the human-friendly output. It’s perfectly useful as is, but aren’t we all about the extra touches? :) #