PageSelector Multilanguage
Hello,
I'm using Sitefinity 5.1 and have problems with a Page selector control. The website is multilingual. Now I seem that the page selector always shows the page tree of the default language. If the default language is english, the english page tree will be displayed.
I need to display the page tree language depending on the language of the page I'm editing. If I edit spanish page, the page tree will be displayed in spanish. How I can do that?
Here's my code:
Designer.ascx
div class="rwWindowContent rwExternalContent">
<
div
class
=
"sfDialog sfSelectorDialog sfDesignerSimpleMode"
>
<
ul
>
<
li
>
<
sf:PageField
ID
=
"PageSelector"
runat
=
"server"
WebServiceUrl
=
"~/Sitefinity/Services/Pages/PagesService.svc/"
DisplayMode
=
"Write"
/>
</
li
>
</
ul
>
</
div
>
</
div
>
public
class
DesignerMapping : ContentViewDesignerView
public
override
IEnumerable<System.Web.UI.ScriptDescriptor> GetScriptDescriptors()
var descriptor =
new
ScriptControlDescriptor(
this
.GetType().FullName,
this
.ClientID);
descriptor.AddComponentProperty(
"PageSelectorControl"
,
this
.Container.GetControl<Telerik.Sitefinity.Web.UI.Fields.PageField> (
"PageSelector"
,
true
).ClientID);
return
new
[] descriptor ;
protected
override
void
InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
this
.Container.GetControl<Telerik.Sitefinity.Web.UI.Fields.PageField>(
"PageSelector"
,
true
).RootNodeID = Telerik.Sitefinity.Abstractions.SiteInitializer.FrontendRootNodeId;
DesignerMapping =
function
(element)
DesignerMapping.initializeBase(
this
, [element]);
this
._pageSelectorControl =
null
;
DesignerMapping.prototype =
initialize:
function
()
DesignerMapping.callBaseMethod(
this
,
'initialize'
);
,
dispose:
function
()
DesignerMapping.callBaseMethod(
this
,
'dispose'
);
,
refreshUI:
function
()
var
pageid =
this
.get_controlData().PageID;
if
(pageid )
this
.get_pageSelectorControl().set_value(pageid);
,
applyChanges:
function
()
this
.get_controlData().LoginPageID =
this
.get_pageSelectorControl().get_value();
,
get_controlData:
function
()
return
this
.get_parentDesigner().get_propertyEditor().get_control();
,
get_parentDesigner:
function
()
return
this
._parentDesigner;
,
set_parentDesigner:
function
(value)
this
._parentDesigner = value;
,
get_pageSelectorControl:
function
()
return
this
.pageSelectorControl;
,
set_pageSelectorControl:
function
(value)
this
._pageSelectorControl = value;
Hi Nathalia,
You could try to add this code to your Initialize method:
if
(
this
.PropertyEditor !=
null
)
var uiCulture =
this
.PropertyEditor.PropertyValuesCulture;
this
.PageSelectorControl.UICulture = uiCulture;
Hi Daniel,
Thanks for you reply. I used to ContentViewDesignerView so in this class doesn't have the this.PropertyEditor property and my control PageField doesn't contain a definition for 'UICulture', I don't know if exist a instance for that object.
this
.Container.GetControl<Telerik.Sitefinity.Web.UI.Fields.PageField>(
"PageSelector"
,
true
).UICulture = uiCulture;