Creating a language in code
Note that Features module supports exporting languages.

Answering the question:

// Example language: fr.
$language = (object)array(
  'language' =&gt; 'fr',
  'name' =&gt; 'French',
  'native' =&gt; 'Français',
  'direction' =&gt; 0,
  'enabled' =&gt; 1,
  'plurals' =&gt; 0,
  'formula' =&gt; '',
  'domain' =&gt; '',
  'prefix' =&gt; 'fr',
  'weight' =&gt; 0,
);

locale_add_language($language-&gt;language,
  $language-&gt;name,
  $language-&gt;native,
  $language-&gt;direction,
  $language-&gt;domain,
  $language-&gt;prefix,
  $language-&gt;enabled);

// Additional params not implemented in locale_add_language().
db_update('languages')
  -&gt;fields(array(
    'plurals' =&gt; $language-&gt;plurals,
    'formula' =&gt; $language-&gt;formula,
  ))
  -&gt;condition('language', $language-&gt;language)
  -&gt;execute();