<p>This is expected behaviour though, it's better (in my opinion) than leaving everything empty.</p>

<p>As Andrew said in his comment, you could by default disable all locales on this section so your entry wouldn't be published in multiple locales.</p>

<p>You can do this by going to the settings of your section:
<a href="https://i.sstatic.net/k3ywa.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/k3ywa.png" alt="Screenshot of disabled locales"></a></p>

CC BY-SA 3.0
2016-02-29T22:37:42.987Z
2016-02-29T23:35:49.407Z
2016-02-29T23:35:49.407Z
Maarten de Graaf
<p>Can you create an Entry with content only for a specific Locale? For instance, I have <code>U.S. English (en_us)</code> and <code>German (de)</code> locales setup for a section. I want to create entries, but only populate one locale. Is this possible?</p>

<pre><code>$entry = new EntryModel();
$entry-&gt;getContent()-&gt;title = 'Testing Locale';
$entry-&gt;sectionId = '14';
$entry-&gt;typeId = '16';
$entry-&gt;locale = 'de';
$entry-&gt;localeEnabled = true;

$entry-&gt;setContentFromPost(array('plainTextField' =&gt; 'Test'));

craft()-&gt;entries-&gt;saveEntry($entry);
</code></pre>

<p>The resulting code above creates the entry fine, but content is present for both locales. Is this expected behaviour?</p>

CC BY-SA 3.0
2016-02-28T10:38:03.253Z
Check if your section has both locales enabled as default. It may work better if they're not default and your plugin specifically enables the locale - as you have above.
Mutual
<plugin-development><localization>
Creating locale-specific entries from plugin
# Creating locale-specific entries from plugin

(Asked by: username_0 on 2016-02-25)

Can you create an Entry with content only for a specific Locale? For instance, I have U.S. English (en_us) and German (de) locales setup for a section. I want to create entries, but only populate one locale. Is this possible?
$entry = new EntryModel();
$entry->getContent()->title = 'Testing Locale';
$entry->sectionId = '14';
$entry->typeId = '16';
$entry->locale = 'de';
$entry->localeEnabled = true;

$entry->setContentFromPost(array('plainTextField' => 'Test'));

craft()->entries->saveEntry($entry);

The resulting code above creates the entry fine, but content is present for both locales. Is this expected behaviour?

**Tags:** plugin-development, localization

> **Comments:**
> **username_1**: Check if your section has both locales enabled as default. It may work better if they're not default and your plugin specifically enables the locale - as you have above.  

---

## 1 answers

### Answer by username_2 on 2016-02-29. Score: 3 | Accepted answer

This is expected behaviour though, it's better (in my opinion) than leaving everything empty.

As Andrew said in his comment, you could by default disable all locales on this section so your entry wouldn't be published in multiple locales.

You can do this by going to the settings of your section:
[![Screenshot of disabled locales](https://i.sstatic.net/k3ywa.png)](https://i.sstatic.net/k3ywa.png)


---

