-
Notifications
You must be signed in to change notification settings - Fork 79
Error Migrating Variant (Multi Lingual) Content #303
Description
We have a multi-lingual site which we are migrating Nested Content to Block List using uSync Migrations (version 4.0.0-phase.5.1). It migrates fine when content has multiple language versions, but when content only has one language version, the migration output file is missing the culture attribute for the values and it tries to update the invariant language instead causing an error.
The problem is due to the code at the following line which assumes just because there's only one value, it is not dealing with variants.
uSyncMigrations/uSync.Migrations.Core/Handlers/Eight/ContentBaseMigrationHandler.cs
Line 67 in 5687fcc
| if (property.Elements("Value").Count() > 1) |
We've made a temporary fix to change this logic which resolves the problem, but I'm not sure if this has any unwanted consequences so I've not submitted it as a PR.
protected override IEnumerable<XElement> ConvertPropertyValue(string itemType, string contentType, XElement property, SyncMigrationContext context)
{
var cultures = property.Elements("Value").Attributes("Culture");
if (cultures.Count() > 0)
{
Hopefully this will help someone else and maybe a fix can get added. Happy to submit a PR if you think the fix is OK?