Skip to main content
added 2 characters in body
Source Link
sukesh
  • 3.3k
  • 3
  • 29
  • 78

When I publish the Home item, the selected language is English. But in code, the Root Item is coming as da (Danish).

enter image description here

On publish, for languages, I selected both Danish & English. So, is it taking the first language in that list?

enter image description here

How can I get the language that was selected, when the item was being publishpublished, i.e English in this case.

patch.config:

<pipelines>
  <publish>
    <processor type="MyCode.Handlers.AuditPublish, MyCode"/>
  </publish>
</pipelines>

AuditPublish.cs

public class AuditPublish:PublishProcessor
    {
        public override void Process(PublishContext context)
        {
            var rootItem = context.PublishOptions.RootItem;
        }
    }

When I publish the Home item, the selected language is English. But in code, the Root Item is coming as da (Danish).

enter image description here

On publish, for languages, I selected both Danish & English. So, is it taking the first language in that list?

enter image description here

How can I get the language that was selected, when the item was being publish, i.e English in this case.

patch.config:

<pipelines>
  <publish>
    <processor type="MyCode.Handlers.AuditPublish, MyCode"/>
  </publish>
</pipelines>

AuditPublish.cs

public class AuditPublish:PublishProcessor
    {
        public override void Process(PublishContext context)
        {
            var rootItem = context.PublishOptions.RootItem;
        }
    }

When I publish the Home item, the selected language is English. But in code, the Root Item is coming as da (Danish).

enter image description here

On publish, for languages, I selected both Danish & English. So, is it taking the first language in that list?

enter image description here

How can I get the language that was selected, when the item was being published, i.e English in this case.

patch.config:

<pipelines>
  <publish>
    <processor type="MyCode.Handlers.AuditPublish, MyCode"/>
  </publish>
</pipelines>

AuditPublish.cs

public class AuditPublish:PublishProcessor
    {
        public override void Process(PublishContext context)
        {
            var rootItem = context.PublishOptions.RootItem;
        }
    }
Source Link
sukesh
  • 3.3k
  • 3
  • 29
  • 78

PublishContext.PublishMode.RootItem is showing the wrong item language version

When I publish the Home item, the selected language is English. But in code, the Root Item is coming as da (Danish).

enter image description here

On publish, for languages, I selected both Danish & English. So, is it taking the first language in that list?

enter image description here

How can I get the language that was selected, when the item was being publish, i.e English in this case.

patch.config:

<pipelines>
  <publish>
    <processor type="MyCode.Handlers.AuditPublish, MyCode"/>
  </publish>
</pipelines>

AuditPublish.cs

public class AuditPublish:PublishProcessor
    {
        public override void Process(PublishContext context)
        {
            var rootItem = context.PublishOptions.RootItem;
        }
    }