3

I'm trying to create a link that opens the content editor with the following conditions:

  1. Specific item pre-selected
  2. Specific language pre-selected
  3. Translate mode (version tab > translate button) with a 2nd language pre-selected

So far all the material I've come across has helped me generate this path with querystrings

/sitecore/shell/Applications/Content%20Editor?fo={22104F75-F60E-4A1C-A172-EF753DDAB447}&sc_content=master&la=en-us

Are there additional parameters that exist to pre-select translation mode and translation language?

1
  • 1
    If I’m not mistaken the translate mode is controlled by the Sitecore Registry. So you cannot activate it via a url OOTB Sitecore Commented Jun 11, 2020 at 9:13

1 Answer 1

2

As Hishaam wrote in his comment, there is nothing like that in Sitecore out of the box.

When user clicks the "Translate" button in the ribbon, Sitecore saves that information in Sitecore Registry. You can add a new httpRequestBegin processor that would check your custom parameter and set translate mode in user's registry information.

The class:

public class EnableTranslateMode : Sitecore.Pipelines.HttpRequest.LanguageResolver
{
    public override void Process(Sitecore.Pipelines.HttpRequest.HttpRequestArgs args)
    {
        if (Sitecore.MainUtil.GetBool(args.HttpContext.Request["translate"], false)
            && Sitecore.Context.User.IsAuthenticated)
        {
            Sitecore.Web.UI.HtmlControls.Registry.SetString("/Current_User/Content Editor/Translate", "on");
        }
    }
}

Config:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <httpRequestBegin>
        <processor name="EnableTranslateMode"
           type="MyAssembly.MyNamespace.EnableTranslateMode, MyAssembly"
           patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.LanguageResolver, Sitecore.Kernel']" />
      </httpRequestBegin>
    </pipelines>
  </sitecore>
</configuration>

And the url:

 /sitecore/shell/Applications/Content%20Editor?translate=true&fo={22104F75-F60E-4A1C-A172-EF753DDAB447}&sc_content=master&la=en-us

So when there is translate=true or translate=1 in the url, Sitecore will set the information in the Registry.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.