Create Structure on Plugin Install
I haven't used locales before so i'm not entirely sure, but when I looked in the craft service that saves a section there is a bit that looks like:

foreach ($sectionLocales as $localeId =&gt; $sectionLocale)
...


Which I assume then means your array needs to look like this:

array(
 'en' =&gt; // model
)


Whereas yours was looking like this:

array(
 0 =&gt; // model
)


So craft was seeing 0 as the locale id and it was failing.

So I managed to get this to work by using the following code:

public function onBeforeInstall()
{
  // Get the current locales ID
  $currentLocale = craft()-&gt;locale-&gt;getId();

  $section = new SectionModel();
  $section-&gt;name = 'Demo';
  $section-&gt;handle = 'demo';
  $section-&gt;type = 'structure';
  $section-&gt;hasUrls = 1;
  $section-&gt;template = 'demo/page';
  $section-&gt;enableVersioning = 1;

  // Index the locales by their ID e.g en returns array
  $locales = craft()-&gt;sections-&gt;getSectionLocales(1, 'locale');

  // Target the locale we want by the key in the array
  $locales[$currentLocale]-&gt;urlFormat = 'demo/{slug}';
  $locales[$currentLocale]-&gt;nestedUrlFormat = '{parent.uri}/{slug}';

  $section-&gt;setLocales($locales);

  $response = craft()-&gt;sections-&gt;saveSection($section);
}


The Demo section was added and I got the 'IT WORKED' response, I hope that helps!

Edit

I suppose if you didn't want all the locales to be saved to a section you could just do something like:

$specificLocales = array();

// After setting the locale attributes
$specificLocales[$currentLocale] = $locales[$currentLocale];

$section-&gt;setLocales($specificLocales);