ISO 639 Language Codes
The ISO 639 document (available here or here) defines codes for a majority of languages. These codes are very useful for categorizing documents or other materials; and by using a standard set of codes everyone can understand your language categories. In order to facilitate lookup of these codes it is often useful to load them into a RDBMS or DSA.
Storing ISO639 Information In An LDAP DSA
A LDAP schema suitable for use with OpenLDAP is available here as part of the LDAP Schema Collection. This schema defines two objectclasses: iso639languageDefinition and iso639languageInfo.
iso639languageDefinition has two attributes: iso639languageName and iso639languageCode. The iso639languageName contains the descriptive name of the language and iso639languageCode contains the two character code associated with that language. This objectclass is for storing an enumeration of the languages defined in ISO639 within your Dit. With a little seach and replace in order to form the DNs to fit your Dit you should be able to load the iso639.ldif file into your DSA.
iso639languageDefinition is an auxilliary objectclass with only one value: iso639languageCode. The purpose of this objectclass is to allow you to associate an ISO639 language code with any object within your DSA (as an auxilliary objectclass can be associated with an object regardless of structural objectclass chain issues).
Storing ISO639 Language Information In An RDBMS
To store ISO639 language codes in a relation database management system simply create a table for the list of codes and save one of the provided code lists (OOo 2.x format, XLS format) to a delimited file and use you database's import facilities to load the file.
In PostgreSQL, for example, you'd create a table like:
CREATE TABLE iso639 (
language_code CHAR(2) PRIMARY KEY,
language_name VARCHAR(55) NOT NULL);
Then open one of the files in the appropriate application, remove the header rows, and save it as a delimited text file with TAB as the delimiter and no quotation of text fields. You should be able to look at the file in a text editor and just see two 'naked' columns.
tw Twi
uk Ukrainian
ur Urdu
uz Uzbek
Then in the psql client run the command:
\copy iso639 from /home/awilliam/ISO639LanguageCodes.csv;
The data will be imported into the table. As SELECT should return the data:
SELECT * FROM iso639;
language_code | language_name
---------------+------------------
aa | Afar
ab | Abkhazian
af | Afrikaans
am | Amharic
ar | Arabic
as | Assamese
ay | Aymara
az | Azerbaijani
| Attachment | Size |
|---|---|
| iso639.ldif.gz | 2.02 KB |
| ISO639LanguageCodes.ods.gz | 13.28 KB |
| ISO639LanguageCodes.xls.gz | 4.19 KB |
