Translation Manager – Exclude Blockgrid Module from Translation / Override Mapper

Hi,

the anchor value forms part of the URL so generally isn’t touched - and if it’s pointing to somewhere else in your content then that will also be an id on an element ? (e.g <h1 id=”sub-topic”> ) and that Id shouldn’t be getting sent to translation either (so it should be the same each language?

I would worry if you did something global to all link anchors it might have side effects ? but if you really need to. its also worth noting the anchor value is a Anchor/query string parameter in umbraco so you would want to be really sure it was something you wanted to drop.

If you want to remove them i think the best thing to do would be to have something that ran code when the TranslationJobPartialApprovalNotification notification is fired by Translation manager.

this happens when someone approves a job, (well at least one item in a job, hence partial).

for example (code isn’t tested, but is probably what you need)

public void Handle(TranslationJobPartialApprovalNotification notification)
{
    if (notification.Job == null) return;

    foreach(var node in notification.Nodes)
    {
        var targetItem = _contentService.GetById(node.TargetNodeId);
        foreach(var property in targetItem.Properties)
        {
            var alias = property.PropertyType.PropertyEditorAlias;
            if (property.PropertyType.PropertyEditorAlias != Constants.PropertyEditors.Aliases.MultiUrlPicker) continue;

            // assuming here you are not using variants .
            // if you are you need to get by culture.
            var value = property.GetValue();
            var picker = JsonConvert.DeserializeObject<MultiUrlPickerValueEditor.LinkDto[]>(value.ToString());
            foreach(var link in picker)
            {
                if (link.QueryString.StartsWith('#'))
                    link.QueryString = "";
            }

            property.SetValue(picker);
        }

        if (targetItem.IsDirty())
            _contentService.Save(targetItem, userId: notification.UserId);
    }
}