LoC.gov ISO 639-2 Language Codes Parser is a script to parse the raw text file for the ISO 639-2 standard into a local MySQL database.
- PHP 5.3 + (with mbstring)
- MySQL 5.x
- This script is designed to run on the command line.
Create the database (insert your database name):
CREATE DATABASE IF NOT EXISTS database_name DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;
Create the table:
CREATE TABLE IF NOT EXISTS t_languagecode (
c_id SERIAL PRIMARY KEY,
c_code3 CHAR(3) DEFAULT NULL,
c_code3b CHAR(3) DEFAULT NULL,
c_code2 CHAR(2) DEFAULT NULL,
c_nameeng VARCHAR(96) DEFAULT NULL,
c_namefre VARCHAR(96) DEFAULT NULL
Download loc.gov-iso639-2.php and and edit it, setting your database configuration.
$CFG['db']['host'] = 'localhost';
$CFG['db']['port'] = 3306;
$CFG['db']['user'] = null;
$CFG['db']['pass'] = null;
$CFG['db']['name'] = null;
Run the script -- it should only require a few seconds.
This project is BSD (2 clause) licensed.