Creating a language in code I want to set create a language in PHP code (for example, using a hook_update_n implementation) so I can deploy and automate it.

How?
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();