In this article I’d like to show simple Edit Mode extension for copying property values to other language versions.
In one of my previous blogposts about reverting property to a specific version I described how to update property value using property from another version. Today I’d like to show the oposite scenario. We would like to populate other content versions with current property value.
Use case
Let’s assume we have a multi-language site environment that supports 10 languages. Main content is created by starting from English version and then other languages are added. When creating language version, we can use for example LanguageManager to copy values of all culture-specific properties from master language to the new version.
It can be more difficult to maintain content when Editor is not adding but editing multi-language page, because sometimes, when updating culture-specific property in master language we would like to populate this value to other language versions too. For example:
- We can have link property, that was updated in English version. We would like to copy it to all languages and then update with specific value for language if needed.
- The page title was updated and value in other languages make no sense anymore. Then it could be better to temporary use English version in the language branch, before we get proper translation.
- New property was defined in model and Editor would like to populate it to other languages.
- We have a settings property (like checbox), that is culture-specific, because there are some exceptions in cofiguration for language branches and we would like to update it everywhere.
We might have a property with a link that needs to be updated for each language.
To change property in different languages Editor would have to go into all 10 language versions, find property and update it which is very time consuming.
Copying property extension
I prepared a simple client script that allows to copy language-specific property value into selected lange versions.
Editor has to select target languages (only languages available for selected content are displayed) and values are copied.
If the language version is published, a new draft will be created. Otherwise, an existing draft will be used.
Updated content is not published automatically to allow Editor to review changes.
Below you can find demo of the plugin.
Installation
All code is just one file available as a gist. It has to be copied to the site and added as an initialization module.