Alphabet Dictionary Module

With this module you can define different dictionary folder for each Site you have or you can define shared dictionary folder cross some sites as well. it is useful when you  have multi Sites installed in Sitecore content tree and you need to organize your Dictionary items in proper way to avoid conflicts. i am using Sitecore custom cache to cache the dictionary items for the context Site and context Language as well.

Marketplace

https://marketplace.sitecore.net/Modules/S/Sitecore_Alphabet_Dictionary.aspx

Video

Github :

https://github.com/abarhoum/SitecoreDictionary

Sitecore Versions

SXP8.2 : Compatible only with Sitecore 8.2, It will not work on earlier Sitecore versions as it is using the new Sitecore Custom cache functionality.

Features

  • Built based on Helix Principles.
  • Using Sitecore search APIs.
  • Using Sitecore Custom Cache.
  • Define the Dictionary location path and Cache key for each Site.
  • Create Cache object for the context Site and context language as well.

Dependencies :

If you have implemented helix on your project you need only the following dlls from this module :

Sitecore.Foundation.SitecoreCache.dll

Sitecore.Foundation.Dictionary.dll

Note: You can use this module even if your site not build on helix
but you have to :
1) Take all the dlls in the Sitecore package.
2) Make sure the website root is inherited from 
   "Dictionary Foundation template" 

 

 Installing and Configurations

  • Download the SitecoreAlphabetDictionary-1.0.zip Package from Marketplace
  • Navigate to “\App_Config\Include\Foundation\Foundation.SitecoreCache.config” to change the cache site if you wantSitecore.Foundation.SitecoreCache.CacheSize : by default is 20MB

How it works :

When you install the module navigate to /sitecore/templates/Foundation/Dictionary/Dictionary Foundation  template

You will find the following fields :

Dictionary Folder : you will chose what dictionary folder for your Site.

Dictionary Cache Key : this is just for caching the context site, you may have different one for each site.

cache

Example : 

For Site1 i have define my dictionary items in the global folder as below :

Alphabet

Make the Site root inherited from Dictionary Foundation template, and then you can choose your folder and define your cache :

Siteroot

Note: Code assumes these settings are exist on the root site. 
so the site root should be inherited from this otherwise it will not work.
and you have to change line 60 in the code:
siteRootItem = Context.Site.Database.GetItem(Context.Site.RootPath);

Caching:

As I mentioned before it creates different cache object for the context site and context language  as below:

Sitecore.Foundaiton.SitecoreCache.DictionaryItems.[ContextSite].[ContextLanguage]

Example :

cachekey

I hope you find this post helpful, If you have any additional knowledge on this subject, comments or questions, please let me know in the comments section below.

6 thoughts on “Alphabet Dictionary Module

  1. Have you ever taken a look at the Dictionary Domain feature in Sitecore, it’s been there since 6.6:

    https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/sitecore-asp-net-cms-6-6-features-dictionary-domains
    https://www.markstiles.net/blog/2015/3/15/sitecore-dictionary-redux/

    That allows you set up a Global Dictionary, or individual Dictionary per site with fallback (which is nice if you just need to override a few entries for the secondary sites). It will also respect language fallback features that was introduced in 8.1 and has all the caching mechanisms in place.

    Like

    1. Hi Jammy,
      I used Sitecore dictionary domain before, and it has performance issue specially when you use : Translate.TextByDomain() as it will do direct SQL query to the database. and Sitecore caching the dictionaries in binary file which is (dictionary.dat) and it has caching issues also when you have multi language and more than one CD server, and you need to write some code on publish end remote to reset the cache : check out this
      https://stackoverflow.com/questions/36233165/sitecore-dictionary-items
      anyways here i am using Sitecore search APIs, and also i am using different caching mechanism.
      Thanks!

      Like

      1. It works fine for multilingual and multiple CD servers. If you are having issues then it’s most likely that events are not being passed via core database correctly or not being read correctly. I’ve been using domain dictionary for a long time without the issues you mention or in that answer.
        The performance issue for TextByDomain can be “worked around” by using the ID for the dictionary folder rather than ItemName. This means the fast: code is not called to lookup the folder and instead the item is loaded directly.
        https://sitecore.stackexchange.com/questions/7083/sitecore-dictionary-performance-question/7085#7085

        Like

    1. Hi Devendra,

      Of course yes, from my side i am using Sitecore search API and different caching mechanism. you can see my reply for the first comment.

      Thanks!

      Like

Leave a reply to Devendra Saini Cancel reply