Fields inside blocks should allow localized default values [Edited title]

I have fields that are within blocks that need to have localized defaults added to them (like a header that says Location, for example).

When I add a field directly to a model, I am able to activate localization for the field, and I am able to add localized defaults. When I add a field to a block, I am unable to do that. How can I do this?

Hi @fitzage,

Welcome to the Dato forum!

I’m sorry for the bad news here, but I don’t think that is possible in our current system. Blocks don’t have their own localizations per se; it’s the field around the block (like a structured text or modular content field) that would be localized instead, and there’s no way to specify default blocks within those :frowning:

Some ideas…

  1. We can convert this thread into a feature request instead and hope that this functionality gets added?

  2. You can write a DatoCMS plugin to programatically add this functionality yourself, or perhaps fork an existing one like Computed Fields

Sorry about that!

I guess making it a feature request is the way to go. I find this a little weird, because most of what I would want to have localized defaults are within blocks, not top level in the model. ¯_(ツ)_/¯

I’ll look into writing a plugin, but I don’t see that being something I’ll get up to speed on soon.

Maybe – I’m just hypothesizing here – the blocks were initially envisioned as composable, reusable chunks that would be different in every instance? I think most of the time, if people want the same default data in every record, they would use normal fields instead of blocks.

Regardless, it makes sense, and I’ll turn this into a feature request for you (please vote for it at the top). Sorry for the inconvenience here, and let me know if you ever want any guidance / help with the plugins. Otherwise, hopefully this will get added!

Thanks again for the suggestion :slight_smile:

Thanks. The use case we’re envisioning here is that most of these blocks include headers that will show on the page. One way of building this is for the template itself to provide the headers, and use i18n strings in Astro for the localized header for each block.

The reason we wanted to put these in the blocks themselves is so that we could have default headers, but they could be modified if necessary.

1 Like

Makes total sense.