I am experiencing strange workings of the dictionary in Sitecore JSS. As mentioned in https://jss.sitecore.net/#/sitecore-net-dev?id=for-sitecore-net-developers, I have created an item of template /sitecore/templates/System/Node under my website and created dictionary entries below and set dictionaryDomain to the id of that item in the app configuration. What I expect to get for the dictionary when I do a call to http://jss-sc.sampleadvancedapp/sitecore/api/jss/dictionary/JssAdvancedApp/en?sc_apikey={API_KEY} is the items below the configured node.

However, what seems to happen is that the keys of the items below the configured node are used to search for entries in the standard dictionary folder of sitecore (/sitecore/system/Dictionary) and if a match is found based on the key, the value of the item in the standard sitecore dictionary is used. If no match is found, then the dictionary entry is returned with the key as it's value.

If I look into the code of: Sitecore.JavaScriptServices.Globalization.Dictionary. TranslationDictionaryReader, this is expectable because of the lines:

string str1 = item["Key"];
string str2 = this.Translate.TextByLanguage(domain.Name,   TranslateOptions.Default, str1, language, str1, (object[]) null);
keyValuePairSet.Add(new KeyValuePair<string, string>(str1, str2));

Is this how it is supposed to work? My expectation was that we could create stand-alone dictionaries for the different apps without references to the standard sitecore dictionary.

  • Checkout updates dictionary import functionality in Preview 2, it’s enabled in advanced-sample-react – Alex Shyba Mar 3 at 19:35

Your expectation is correct :)

Could you please verify that your API Key has the Impersonation User explicitly set?

We've updated the docs recently, you might have configured the API key before the update.

"...the Impersonation User will need to access the items under /sitecore/system. By default, the ServiceAPI user doesn't have read access to that content area. To address this, you will have to specify a new account there with appropriate permissions or simply put standard extranet\anonymous in there."

https://jss.sitecore.net/#/setup/sitecore-config?id=step-3-api-key

If this doesn't work, please confirm the name of the context database in Layout Service response (as you may need to publish).

"...By default the JSS dictionary service will utilize the default dictionary domain of the context database, i.e. /sitecore/system/Dictionary in master or web. You can configure the app's dictionary domain in the App configuration."

Hope this helps!

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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