Developing for Multilanguage Sites
Hi guys,
have someone experience with writing custom widgets for Multilanguage sites ? I have tried the widget selector from Josh, but it is not working in other language as primary language of the whole site. As seen on screenshot, the PageSelector selects Pages in primary language. @Telerik: It will be nice write an article covering the development for Multilanguage sites (selectors, controls, etc.).
Pavol
Hi Pavol,
I'm working on a multilingual site with custom widgets as well. The page selector didn't work for me at first, and the linking option in a HtmlField didn't either. I copied the code generated by Thunder and ended up with this:
You probably already have something like this in the designer code:
Protected
Friend
Overridable
ReadOnly
Property
PageSelectorLinkPageGUID()
As
PagesSelector
Get
Return
Me
.Container.GetControl(Of PagesSelector)(
"pageSelectorLinkPageGUID"
,
True
)
End
Get
End
Property
Protected
Overrides
Sub
InitializeControls(container
As
Telerik.Sitefinity.Web.UI.GenericContainer)
If
(
Me
.PropertyEditor IsNot
Nothing
)
Then
Dim
uiCulture =
Me
.PropertyEditor.PropertyValuesCulture
Me
.PageSelectorLinkPageGUID.UICulture = uiCulture
End
If
End
Sub
Hi Arno,
the sample code from Josh is in C# .... in Designer i have following methods
protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
// load in simple mode
base.DesignerMode = ControlDesignerModes.Simple;
// set root node for page selector
PageSelector.RootNodeID = Telerik.Sitefinity.Abstractions.SiteInitializer.FrontendRootNodeId;
// set the image selector type to use string (src)
ImageSelector.DataFieldType = typeof(String);
// initialize the taxonomy selectors
CategoriesSelector.TaxonomyId = TaxonomyManager.CategoriesTaxonomyId;
TagsSelector.TaxonomyId = TaxonomyManager.TagsTaxonomyId;
/// <summary>
/// Gets the page selector.
/// </summary>
protected PageField PageSelector
get return Container.GetControl<PageField>("PageSelector", true);
No PageSelectorLinkPageGUID :(
Hi Pavol,
Translated to C# and that sample code I would guess that adding this code below "PageSelector.RootNodeID = Telerik.Sitefinity.Abstractions.SiteInitializer.FrontendRootNodeId;" may work:
if
((
this
.PropertyEditor !=
null
))
object
uiCulture =
this
.PropertyEditor.PropertyValuesCulture;
this
.PageSelector.UICulture = uiCulture;
Hi Arno,
i'm running Sitefinity 5.1.3450 SE .... there is no UICulture Property on PageSelector :( .... I have found following Article in Forum. Regarding Telerik Support Staff is a bug on PageSelector ...
www.sitefinity.com/.../pageselector-pagesservice
Pavol
Hi Pavol,
That's too bad. I hope someone knows a work around in case you can't upgrade. I'm running 5.2.3800. It works there.
Hi Arno,
thanks for your Info. I hope the customer pay a license upgrade and i can continue deliver the "right code" :)
Greetings,
Pavol
Hi Arno,
i have tried this with 5.2.3800 SE with no sucess .... the UICulture Property is definitelly missing on PageSelector object ! Have i something omitted ? The PageSelector is of Type PageField in my Designer class.
protected PageField PageSelector
get return Container.GetControl<PageField>("PageSelector", true);
Greeetings,
Pavol
Hi Pavol,
You can try to use the type Telerik.Sitefinity.Web.Ui.PagesSelector. That works for me.
Hi Arno,
can you send me the Designer Implementation ? What i need is store some links in custom widget for navigation. I use the PageField for storing the data. My mail adress is pavol.kokinda@gmail.com
Thanks,
Pavol
Sure, I just sent the files. It's in VB.NET, but you can use the Telerik Code Converter to convert to C#. Most of the code has been generated by Thunder.
That's weird, the mail just bounced with this message: "Remote host said: 552 5.7.0 review our attachment guidelines". I just attached a zip file.
Can't attach it to this post either. Just images allowed :-(
Hi Arno,
thanks for your support and cooperation.
Greetings,
Pavol