<p>The solution that ended up working for me was to just turn off all default locales for the section in question.</p>

<p>The problem was that if a locale is on by default, then it seems it's impossible to turn it off until you've filled in all the required fields. But if no locale is active by default, you can just create only the one(s) that you need, and you don't run into the problem of trying to deactivate any of the others (since their status is off by default).</p>

<p>I'd thought that having a default locale would save admins time when posting, but actually with all locales off, no extra steps are added to the process of creating a post, and you actually <em>avoid</em> the step of (and potential problems with) turning off non-required locales.</p>

CC BY-SA 3.0
2015-01-16T09:38:04.157Z
Quick note for anyone looking for these settings. They are not in the config file, but in the admin.
Martin
CC BY-SA 3.0
2014-11-03T11:49:57.563Z
2014-11-03T11:49:57.563Z
Nick F
<p>I don't know if you re-use the fields you're using in that channel in other sections and if you do, my suggestion might not work for you, but here's what you could do:</p>

<p>Set all fields to be "not translatable" and if content is entered in one locale it will get synced to all locales. Thereby all required fields will always be filled out and disabling individual "dummy versions" is no problem any more.</p>

CC BY-SA 3.0
2014-10-13T14:09:12.157Z
Ah, unfortunately one of the fields does need to be translatable - it's a matrix field that's widely used across the site, including on pages where it needs to be fully replaceable on entries for different locales.
Nick F
CC BY-SA 3.0
2014-10-13T14:45:40.950Z
OK, but if that matrix field is the only field that is shared, you could set it to be not required.
carlcs
CC BY-SA 3.0
2014-10-13T16:04:50.223Z
But that's the exact problem I'm having: how to use it across locales while keeping it as required! (cf. last paragraph of my question)
Nick F
CC BY-SA 3.0
2014-10-13T16:26:20.267Z
Yeah I know, but I was thinking you could do an exception for that one matrix field ;)
carlcs
CC BY-SA 3.0
2014-10-13T12:10:15.887Z
2014-10-13T12:10:15.887Z
carlcs
<p>Why don't you leave the entries enabled in all locales and just don't load them in the templates.</p>

<pre><code>{% if craft.locale == 'fr' %}
    {% set entries = craft.entries.section('news-fr') %}
{% elseif craft.locale == 'en' %}
    {% set entries = craft.entries.section('news-en') %}
{% elseif craft.locale == 'de' %}
    {% set entries = craft.entries.section('news-de') %}
{% endif %}
</code></pre>

CC BY-SA 3.0
2014-10-13T14:12:34.783Z
I'm not sure I quite follow this. Is there something special about the '-lang' suffix on a section? Or are you suggesting multiple channels? I'm keen to have them all in the same multilingual section if possible, because nowhere else on the site has different sections for different locales.
Nick F
CC BY-SA 3.0
2014-10-13T14:40:22.443Z
Yes, I actually thought that this is what you're doing, different channels for your locales. But yeah, if you have them all in one channel, then this doesn't work, of course. :D
carlcs
CC BY-SA 3.0
2014-10-13T12:26:54.337Z
2014-10-13T12:26:54.337Z
carlcs
<p>I'm building a multi-lingual site and have found Craft's locales / translatable fields useful for setting up structures where each page will have a translated version. However, for at least one of the Channel sections it would make more sense to have separate entries for each locale, rather than having each entry being translatable and appearing in all locales.</p>

<p>This seems doable by disabling all but one of the locales on each entry in the section, but the problem I'm having is that if an entry has required fields, I can't save it if these fields are empty, even if they're only empty in a locale that I'm trying to disable. (eg. I want to have a Spanish-only post, but when I try to disable the English version I can't save the post because the English version has required fields that aren't filled in...)</p>

<p>It seems I either have to make my required fields non-required, or fill them with spurious stuff in the locale I want to disable. I'm sure there must be a way of making required fields work with multi-lingual posts, but I can't figure out quite how... I'd be grateful for any pointers here!</p>

CC BY-SA 3.0
2014-10-13T12:18:42.983Z
Hmmm... I'd actually try and do a feature request to P&T and ask them if they could implement a setting to disable new entries in a section by default.
carlcs
CC BY-SA 3.0
2014-10-13T14:07:48.533Z
I think you can do this: in the section config page you can set default locales for new entries. I've currently set them to default to off for all locales, which partly solves my problem.
Nick F
CC BY-SA 3.0
2014-10-13T14:35:12.720Z
Oh that's good, I had no idea one can actually already do this. Why does this solve your problem only partly, what else is missing?
carlcs
CC BY-SA 3.0
2014-10-13T16:08:17.047Z
Basically, it seems to work ok with creating new posts (I can now create them with content only in one locale), but if I have an existing post in multiple locales, I can't disable a locale without having to fill in the required fields.
Nick F
CC BY-SA 3.0
2014-10-13T16:25:16.210Z
For existing ones you could do that in the DB or, if there aren't many, delete and create them from scratch. But good to hear that you found a solution, Nick!
carlcs
<localization><field><language><required>
How to use required fields on localised entries?
# How to use required fields on localised entries?

(Asked by: username_0 on 2014-10-13)

I'm building a multi-lingual site and have found Craft's locales / translatable fields useful for setting up structures where each page will have a translated version. However, for at least one of the Channel sections it would make more sense to have separate entries for each locale, rather than having each entry being translatable and appearing in all locales.

This seems doable by disabling all but one of the locales on each entry in the section, but the problem I'm having is that if an entry has required fields, I can't save it if these fields are empty, even if they're only empty in a locale that I'm trying to disable. (eg. I want to have a Spanish-only post, but when I try to disable the English version I can't save the post because the English version has required fields that aren't filled in...)

It seems I either have to make my required fields non-required, or fill them with spurious stuff in the locale I want to disable. I'm sure there must be a way of making required fields work with multi-lingual posts, but I can't figure out quite how... I'd be grateful for any pointers here!

**Tags:** localization, field, language, required
> **Comments:**
> **username_1**: Hmmm... I'd actually try and do a feature request to P&T and ask them if they could implement a setting to disable new entries in a section by default.  
> **username_0**: I think you can do this: in the section config page you can set default locales for new entries. I've currently set them to default to off for all locales, which partly solves my problem.  
> **username_1**: Oh that's good, I had no idea one can actually already do this. Why does this solve your problem only partly, what else is missing?  
> **username_0**: Basically, it seems to work ok with creating new posts (I can now create them with content only in one locale), but if I have an existing post in multiple locales, I can't disable a locale without having to fill in the required fields.  
> **username_1**: For existing ones you could do that in the DB or, if there aren't many, delete and create them from scratch. But good to hear that you found a solution, Nick!  

---

## 3 answers

### Answer by username_0 on 2014-11-03. Score: 0 | Accepted answer

The solution that ended up working for me was to just turn off all default locales for the section in question.

The problem was that if a locale is on by default, then it seems it's impossible to turn it off until you've filled in all the required fields. But if no locale is active by default, you can just create only the one(s) that you need, and you don't run into the problem of trying to deactivate any of the others (since their status is off by default).

I'd thought that having a default locale would save admins time when posting, but actually with all locales off, no extra steps are added to the process of creating a post, and you actually *avoid* the step of (and potential problems with) turning off non-required locales.

> **Comments:**
> **username_2**: Quick note for anyone looking for these settings. They are not in the config file, but in the admin.  

---

### Answer by username_1 on 2014-10-13. Score: 2

I don't know if you re-use the fields you're using in that channel in other sections and if you do, my suggestion might not work for you, but here's what you could do:

Set all fields to be "not translatable" and if content is entered in one locale it will get synced to all locales. Thereby all required fields will always be filled out and disabling individual "dummy versions" is no problem any more.

> **Comments:**
> **username_0**: Ah, unfortunately one of the fields does need to be translatable - it's a matrix field that's widely used across the site, including on pages where it needs to be fully replaceable on entries for different locales.  
> **username_1**: OK, but if that matrix field is the only field that is shared, you could set it to be not required.  
> **username_0**: But that's the exact problem I'm having: how to use it across locales while keeping it as required! (cf. last paragraph of my question)  
> **username_1**: Yeah I know, but I was thinking you could do an exception for that one matrix field ;)  

---

### Answer by username_1 on 2014-10-13. Score: 1

Why don't you leave the entries enabled in all locales and just don't load them in the templates.
{% if craft.locale == 'fr' %}
    {% set entries = craft.entries.section('news-fr') %}
{% elseif craft.locale == 'en' %}
    {% set entries = craft.entries.section('news-en') %}
{% elseif craft.locale == 'de' %}
    {% set entries = craft.entries.section('news-de') %}
{% endif %}

> **Comments:**
> **username_0**: I'm not sure I quite follow this. Is there something special about the '-lang' suffix on a section? Or are you suggesting multiple channels? I'm keen to have them all in the same multilingual section if possible, because nowhere else on the site has different sections for different locales.  
> **username_1**: Yes, I actually thought that this is what you're doing, different channels for your locales. But yeah, if you have them all in one channel, then this doesn't work, of course. :D  

---

