Editing Arabic Content in Sitefinity
I'm building a website which is in both English and Arabic. Sitefinity says that it supports Arabaic.... but it doesn't really work the way it should. When editing content on an Arabic page, content blocks and editor controls should show text in RTL format. This should be a default when working with pages in Arabic (or Hebrew or Farsi) but for some reason it isn't.
I'm trying to find a way to enable this by using ViewMaps to check my pages's theme and if it's Arabic, switch the controls into RTL mode. I have a support ticket with the Telerik team for this but so far they've proven not helpful at all. Has anyone here been able to actually get this to work?
Any help would be appreciated.
Hi Jay,
Thank you for using our services. Since Sitefinity 4.2 we have introduced multilingual templates functionality. This will allow you to create separate templates for your English and Arabic pages, and on the Arabic ones you can apply different theme/ CSS style that loads RTL text direction. For example:
body
font-family
: Georgia;
color
:
black
;
font-size
:
12px
;
background
:
white
;
direction
:
rtl
;
I was actually referring to the editor controls INSIDE Sitefinity, not my templates.
In any case, Radoslav Georgiev from the Telerik team was able to provide a solution. (NOTE to Telerk: Give that man a raise!)
For anyone else that needs RTL editing inside Sitefinity, you can override the HtmlField template to do so:
See http://www.sitefinity.com/blogs/joshmorales/posts/11-07-26/customizing_sitefinity_4_controls_with_the_viewmap.aspx for how to set that up.
You can pull the RTL stylesheets you need for RadEditor here:
http://demos.telerik.com/aspnet-ajax/editor/examples/righttoleft/defaultcs.aspx
In your HtmlField template you'll need to add the following Page_Load event to check for the presence of Arabic (or Hebrew or Farsi) and load the proper editor stylesheets:
protected
void
Page_Load(
object
sender, EventArgs e)
System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentUICulture;
// this will work both for pages and for content modules and will set the RadEditor to be Right to left
if
(!String.IsNullOrEmpty(
this
.Request.QueryString[
"language"
]))
if
(
this
.Request.QueryString[
"language"
] ==
"ar"
)
editControl.DialogsCssFile =
"~/Sitefinity/WebsiteTemplates/MySite/App_Themes/Arabic/Editor/RadEditor_Dialogs_RTL.css"
;
editControl.ContentAreaCssFile =
"~/Sitefinity/WebsiteTemplates/MySite/App_Themes/Arabic/Editor/EditorContentArea_RTL.css"
;
//if you only need this for pages you can use the second if statement
else
if
(!String.IsNullOrEmpty(
this
.Request.QueryString[
"propertyValueCulture"
]))
if
(
this
.Request.QueryString[
"propertyValueCulture"
] ==
"ar"
)
editControl.DialogsCssFile =
"~/Sitefinity/WebsiteTemplates/MySite/App_Themes/Arabic/Editor/RadEditor_Dialogs_RTL.css"
;
editControl.ContentAreaCssFile =
"~/Sitefinity/WebsiteTemplates/MySite/App_Themes/Arabic/Editor/EditorContentArea_RTL.css"
;