Monday, October 12, 2009

Localization of RADControls in Sitecore

One can see that there are a few places in Sitecore CMS backend that are not localized. And that's because they fall out usual translation way.

In particular we are talking about RAD controls: Rich-Text Editor and SpellChecker.

Telerik supports own way of localization their controls via XML files, but this approach doesn't work in Sitecore out-of-the-box.

My investigation was primary aimed on finding the easy enablish RAD controls localization without coding. In particular according to code and Reflector setting the setting CacheLocalization in sitecore\shell\RadControls\Editor\ConfigFile.xml to 'true' should help. Especially since direct requiesting the page sitecore/shell/RadControls/Editor/localization.aspx?type=editor&language=da worked perfectly. Unfortunately playing with settings didn't help.

Thus the last approach was to set Telerik.WebControls.RadEditor.Language property via code.

I used great article from Alexey Romaniuha as an example.

As a result the workaround to enable localization in RAD Controls in Sitecore looks like:

1. Compile the code and put appropriate DLL into bin:

using System;
using Sitecore.Web;

namespace Sitecore.LocalizationEnabling
public class RADSpellWithLangSwitcher : Sitecore.Shell.Controls.RADEditor.RADEditor
new protected void Page_Load(object sender, EventArgs args)
string lang = Sitecore.Context.Language.ToString();

if (lang == "en")
lang = "en-US";
this.Editor.Language = lang;

base.Page_Load(sender, args);


2. Replace in the sitecore\shell\Controls\Rich Text Editor\Default.aspx file

@ Page Language="c#" Inherits="Sitecore.Shell.Controls.RADEditor.RADEditor"


@ Page Language="c#" Inherits="Sitecore.LocalizationEnabling.RADSpellWithLangSwitcher"

3. Create a folder with language code under \sitecore\shell\RadControls\Editor\Localization\ folder.

I guess the approach for the SpellCheker is completely the same, just not publishing it here.