Setting up Dictionary Items (Resource Strings)

As we know that we need to manage the Labels as well from Sitecore which call Resource Strings. The example is below:
117

And many such labels, we need to create in Sitecore so that Content Author can manage these label’s value.

Earlier we use to create a template for Resource string and fetch it like a normal item in the code but now Sitecore gives an Out-of-the-box feature known as Dictionary. The templates for Dictionary are already present, we just need to configure it to use it in our website.

  1. Login to Sitecore Dashboard (http://sitecoredemo.dev.local/sitecore)
  2. Go to Content Editor.
  3. Navigate to Dictionary templates (/sitecore/templates/System/Dictionary).
    118
  4. Dictionary Domain template will be used to create main folder under Global and the same will be mentioned in the Sitecore.config file.
  5. Dictionary folder template can be used when we want to create a folders and put in the dictionary items. Generally we create A-Z dictionary folders and then place the dictionary entries based on its initial letter which makes it easy to locate.
  6. Dictionary entry template is the main template which holds the value for the Labels.
  7. We can set the icons to all these templates in it’s standard values. I am skipping this step.
  8. Lets go to the Global folder (/sitecore/content/Global).
  9. Create a item (Dictionary) based on Dictionary Domain template. [Right click >> Insert >> Insert from template]
    119
  10. Now go to Sitecore.config file (C:\inetpub\wwwroot\SitecoreDemo.dev.local\App_Config)
    120
  11. Open the file in Notepad++ to edit it. Locate the <sites> node in the file.
    121
  12. Locate the <site> node for website, which is highlighted in the above screenshot.
  13. Add this setting – {dictionaryDomain=”Dictionary”} in the configuration.
    122
  14. Save the file. This setting makes sure that whenever we refer the dictionary through code under this website scope it refers to the Dictionary item we created under Global.
  15. Switch back to Sitecore. We need to create below labels under dictionary.
    a. Your name
    b. Email
    c. Product type
    d. Product size
    e. City of departure
    f. Delivery city
    g. Message
    h. Send Estimates
    i. Subscribe
    j. Enter your email.
    h. Subscription message.
  16. Right now I am not considering the Error message for the validations of these forms or the success messages.
  17. As we know that we need to create alphabetically folder before creating entries. We will create alphabets folder as and when required. e.x. while creating “Your name”, we will create “Y” item based on Dictionary folder template and “YourName” item based on Dictionary entry template.
    123
  18. Similarly we will create other labels.
    a. Your name (Y >> YourName)
    b. Email (E >> Email)
    c. Product type (P >> ProductType)
    d. Product size (P >> ProductSize)
    e. City of departure (D >> DepartureCity)
    f. Delivery city (D >> DeliveryCity)
    g. Message (M >> Message)
    h. Send Estimates (S >> SendEstimates)
    i. Subscribe (S >> Subscribe)
    j. Enter your email. (E >> EmailPlaceholder)
    h. Subscription message. (S >> SubscriptionMessage)
  19. Once all the dictionary entries are created, we will see something like below:
    124

Except “Get Free Quote” in the upper left corner in the Header, we are done with creation of all the content required for creating the Layout.

Lets set all the assets from the HTML template in our Sitecore website in the next blog and start creating the layout.

Please let me know in case any of the step in this series is confusing or you have queries about.

Thank you.. Keep Learning.. Keep Sitecoring.. 🙂

 

3 thoughts on “Setting up Dictionary Items (Resource Strings)

  1. Pingback: Content Creation for the Layout – Part II | Sitecore Dairies

  2. The very crux of your writing while sounding reasonable at first, did not really sit perfectly with me personally after some time. Somewhere throughout the sentences you actually managed to make me a believer unfortunately only for a short while. I nevertheless have a problem with your jumps in logic and you would do nicely to fill in those gaps. If you actually can accomplish that, I will definitely be amazed.

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s