0

I would like to know how to copy Sitecore Media Library content from Sitecore page one language to second language?

1

1 Answer 1

1

I would suggest you, use this approach and enhance it as per your needs. However, it will give you at least a start to doing this.

What you need to do is to provide the path of your Item and the Image Field name. It will give you the Media Item ID and you can get that item and create a new language version of that. I have also mentioned some comments where you need to update the values.

# Here you need to provide your item ID and the language version of that item.
$item = Get-Item -Path "master:" -Uri "sitecore://master/<YOUR-ITEM-ID>?lang=en-us&ver=1"

# Here you need to provide your Image field name and you will get that image item
$imageField = [Sitecore.Data.Fields.ImageField]$item.Fields["YOUR-FIELD-NAME"]

# Here you need to get the item ID from the image field and get that image item using the ID
$newitem = Get-Item -Path master: -ID $imageField.mediaID

# Create a new Language item of the image field by providing the Target Language name 
Add-ItemLanguage -Item $newitem -Language "en-US" -TargetLanguage "en" -IfExist OverwriteLatest                     

If you want to make it recursive for all the items of a specific template type, then you can enhance this script.

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.