0

I need to access the dictionary from an XML file to display a message in the publish dialog of a Sitecore 8.2 instance. In the file sitecore\shell\Applications\MarketingAutomation\Controls\SelectList.xml, I found this code:

<input id="search" type="text" class="jq_watermark" title="${Translate.Text(Texts.ENTER_SEARCH_CRITERIA)}"/>

so, in the file \Website\sitecore\shell\Override\Publish\Publish.xml, I tried to emulate it file in this way:

...
      <WizardFormPage ID="Settings" Header='${string.IsNullOrEmpty(WebUtil.GetQueryString("id")) ? Texts.PublishSite : Texts.PublishItem }'
                      Text='${string.IsNullOrEmpty(WebUtil.GetQueryString("id")) ? Texts.SelectTheRelevantPublishingSettingsForYourWebsite : Texts.SelectTheRelevantPublishingSettingsForTheItem }'>
        <WizardFormPadding>
          <p style="color: red; margin:25px 0px; font-size: 1.2rem;">${Translate.Text("PublishingWarning")}</p>
          <Scrollbox ID="SettingsPane" Border="none" Background="transparent">
...

I also tried

... <p style="color: red; margin:25px 0px; font-size: 1.2rem;">@Sitecore.Globalization.Translate.Text('PublishingWarning')</p> ...

I was sure to add the Dictionary item in /sitecore/system/Dictionary. What comes out on the pop up is the literal text in a red font (because of the styling of the p tag), rather than the value of the dictionary item:

${Translate.Text("PublishingWarning")}

4
  • Is the goal to have a translated publishing dialog? Why not update the fields in the Core DB that populate that text?
    – Richard Seal
    Commented Dec 3 at 16:32
  • A publishing warning message was added to the dialog. The goal is to have a way to update the text of that message without having to update the xml file directly. There is no field in the Core DB for this.
    – Michael
    Commented Dec 3 at 17:01
  • @Michael Did you added the dictionary entry inside /sitecore/system/Dictionary folder?
    – ckhanna
    Commented Dec 3 at 17:47
  • Yes, I did. What comes out is the literal text on the screen "${Translate.Text("PublishingWarning")}" rather than the value of the dictionary item
    – Michael
    Commented Dec 3 at 19:21

1 Answer 1

1

You can use Literal to display the Publishing Warning message as below inside the xml file.

<Literal class="publish-warning-text" Text='${Translate.Text("PublishingWarning")}' />

This will display the message from dictionary on the publish dialog. Also you can add the styling for the class name set inside Literal, using the style tag in the xml file.

Hope this helps!!! Let me know in case you face any issues.

2
  • 1
    That did it! Thank you!
    – Michael
    Commented Dec 3 at 22:13
  • It looks like an ID cannot be assigned, which seems odd. When I try to give the "literal" an id, I get an error message "; expected". Not a big deal, this still worked well and I'll be using the class instead for targeting, but if you know how to specify an id successfully, I would prefer it. Here's what I tried: <Literal style="display: none;" id="publish-warning-js-text" Text='${Translate.Text("PublishingWarningJs")}' />
    – Michael
    Commented Dec 4 at 13:29

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.