sveltia / sveltia-cms

Alternative to Netlify/Decap CMS. Fast, lightweight, Git-based headless CMS. Modern UX, first-class i18n support, open source & free. Made with Svelte.
MIT License
726 stars 33 forks source link

Feature Request: `i18n` Option `copy` #120

Open samtrion opened 3 months ago

samtrion commented 3 months ago

Right now, we have the following options for the field property i18n.

@property {boolean | 'translate' | 'duplicate'} [i18n] I18n configuration.

A function copywould wonderfully complement this, as seen with image selection. When I choose an image on the primary page, it's automatically placed in the secondary language, but I can still edit it. This is useful, for example, if I have language-specific images.

kyoshino commented 3 months ago

Good idea. It would copy the value

samtrion commented 3 months ago
  • only from the primary language to secondary languages (and not vice versa)

Why not vica versa? When I start with my native language, which is the configured secondary language. Why not copy to the primary language, if the value of the primary is empty.

kyoshino commented 3 months ago

Because duplicate only copies from primary to secondary, and also, if there are multiple secondary languages, the two-way copy would be a problem. (One of my clients has 4 locales.)

samtrion commented 3 months ago

Ok, good point.

kyoshino commented 3 months ago

only when the value is empty

It’s a bit difficult to do this, so for now, the difference between duplicate and copy would be simply read-only and read-write.