Configured Dictionary Being Ignored


October 12, 2010 by Alistair Deneys

I recently ran into an issue with Sitecore where the dictionary I’d configured for a language was being ignored. Whenever you create a new language in Sitecore a language definition item corresponding to the language is created at /sitecore/system/Languages/[language code]. One of the fields of this language definition item is “dictionary” and is filled in with the filename of the TDF file used by the Telerik editor to perform spell checking in rich text fields. The issue was Sitecore was ignoring this field value and using a different dictionary. I could see this issue because no matter what value I put into that field a US English dictionary was always used to spell check the rich text fields.

The reason this issue came to light was that I was trying to configure Sitecore for the Australian locale. I did this by:

  • Change the flag icon for the default en language from American to Australian
  • Configure the DefaultRegionalIsoCode setting in web.config
  • Change the dictionary value for the language definition item to en-AU

But it would appear changing the dictionary field has no effect. Sitecore was ignoring that value and instead tried to load an appropriate dictionary for en.

The default en language in Sitecore is a neutral culture meaning it doesn’t define a region and doesn’t define region specific formatting rules for numbers and dates. For example, in Australia dates are formatted dd/MM/yy whereas in America dates are formatted MM/dd/yy. Both cultures speak English though (albeit slightly different spelling rules (color vs colour)).

So Sitecore can do things like format dates, etc it requires a specific culture. The .net framework exposes a method on the System.Globalization.CultureInfo class called CreateSpecificCulture. You can pass a neutral culture to this method and .net will look up for the first installed language on the system which has the same language as the neutral one requested. In most cases for en this will be en-US.

So the rich text editor field was loading a dictionary based on the current language name, en, which resulted in the US English dictionary being loaded. I logged this issue with Sitecore support and they’ve confirmed it as a bug. This is good cause it means Sitecore should be fixing the issue, hopefully quite soon.

There are a few workarounds for this issue.

  1. Contact Sitecore Support for a workaround. They provided it to me and I know of at least one other SDN Forum user who also received the workaround.
  2. Rename the dictionary file to en-US.tdf (not desirable as it means you won’t be able to spell check in US English)
  3. Configure the correct specific language in Sitecore before you start content authoring.

The third workaround above isn’t likely to happen as by the time you’ve realised there is an issue with the spell checking dictionary you’ve likely already created some content. So I got to wondering if I could use Revolver to migrate my existing en language content to the new specific language I created?

Revolver contains the cpl command (copy language) which is used to copy content between languages. I could easily couple that with a find command to traverse every single item in the system and copy the content over. I could then hopefully delete the default en language.

This may also be desirable for those that never enter English content into their websites. For example, if I were in Italy creating an Italian only site, what’s the point of having this English language hanging around?

But I thought I should test this idea to make sure it worked. I grabbed an existing Sitecore 6.3 install I had hanging around, added the en-AU language then executed the following command in Revolver to copy all the content from en to en-AU.

find -r (cpl en-AU)

I also threw a timer around that to see how long it would take.

timer (find -r (cpl en-AU))

For the master DB containing 2086 items this took 132 seconds. But the real test here is to see if I can now delete the default en language and have Sitecore work properly.

So off to the control panel I go to delete the en language…and everything appears to be working properly. Just remember to set your site’s language or the DefaultLanguage setting in web.config.


5 thoughts on “Configured Dictionary Being Ignored

  1. Mark Cassidy says:

    Very interesting 🙂 In the past (probably on Sitecore 5.1 or so), I attempted deleting the “en” language, but it made a real mess of things. I’d be interested to hear any followup experiences you have here. If indeed it is possible to remove the “en” language, this would make things a lot easier in many scenarios – also in the UK… Brits don’t much appreciate seeing The Stars And Stripes banner, they much prefer The Union Jack 😉

    • Alistair Deneys says:

      I know what you mean Mark. Clients here in Oz are the same about their flag 🙂
      Playing with the altered installation now it’s missing the en language, everything is still looking pretty good. That would be cause I copied all language content, so no content is missing. I was worried if something (part of the system or external module) was relying on the en language, but so far so good. If I find any weirdness through extended use I’ll post about it.

  2. […] Deneys wrote a post on the dictionary being ignored which you can find here. Then Mark Cassidy read that post and followed it with a post of his own here on Sitecore language […]

  3. […] Deneys wrote a post on the dictionary being ignored which you can find here. Then Mark Cassidy read that post and followed it with a post of his own here on Sitecore language […]

  4. Steven says:

    Just want to share something that i just found out recently. In Sitecore 6.4.0 ++ where they have updated the RTE, the location of the dictionary isnt longer in sitecore/shell/Rad Controls/Spell/localization. It is in sitecore\shell\Controls\Rich Text Editor\Dictionaries. You will need to add the en-AU.TDF in that folder.

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s


The views expressed on this blog are solely my own and do not necessarily reflect the views of my employer.
%d bloggers like this: