Behavior, Content, Money – 3 Things you should never give away for free!!!

BCmoney MobileTV

i18n Languages (HTML) Drop-Down Box

Posted by bcmoney on February 16, 2009 in HTML with 1 Comment


No Gravatar
i18n

courtesy of Flickr

Well when it comes to finding answers to coding-related issues, or finding things in general on the web, I’m usually pretty impressive at coming up with great finds of just about anything i’m looking for. If the usual Search Engines don’t work you can always try a message forum, then finally if all else fails, leave it to chance with question answering services like StackOverflow, Yahoo! Answers, Ask, Aardvark or Wolfram.

This one, however, stumped me completely!

For the life of me, I could not find an existing drop-down box that shows a *COMPLETE* Listing of i18n standards-compliant languages, with accompanying ISO Tags for the Identification of Languages in the VALUE attribute of the OPTION entries in the SELECT drop-down box.

In fact, I’m not even sure if such a thing existed before now, but I just feel like it does somewhere but frustratingly enough, I was unable to find it… So, I looked for a table showing the 2-3 letter codes per country, because I KNEW I had seen one of these before, and used one just a few months earlier for an unrelated project…

Well, long story short, after several redirections I finally found this table called the Codes for the Representation of Names of Languages and came up with the following Drop-Down box (enjoy!):

i18n code:


(In some cases there were no 2-letter ISO 639-1 Code equivalents, in which case I chose the 3-letter ISO 639-2 Code representations. In cases where there were ambiguities between the “B” (bibliographic) or “T” (terminology) representations of ISO 639-2, I always chose the T terminology value instead of simply going with the alphabetic order representation. This is because its more likely that any program which works with the ISO 639-2 standard will go with the official (T) terminology over the (B) Biblio values.

The SQL equivalent is here:
[snippet id=46093]
You could use this data to integrate with other popular services such as Facebook which maintains an XML file of supported langauges/locales. You can also update the simple 2-column i18n SQL script to combine with localization info on your own server, a topic for future discussion…

TO DO:

  • Break Apart the FRENCH-ENGLISH Billingual Drop-Down into FRENCH and ENGLISH versions
  • Implement the drop-down box dynamically in PHP by storing each entry in a Database.
    On a positive note, at least this compontent could be used in a standard web form for submitting each of them (or multiple ones at a time).