1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Localization of links

Localization of links

13 posts, 0 answered
  1. Paul Markham
    Paul Markham avatar
    19 posts
    Registered:
    02 Feb 2010
    02 Feb 2010
    Link to this post
    With a multi-lingual site (localization persistenceMode set to PathPrefix or QueryString), how should links be typed by content editors in generic content? I expected that the sfref attribute of anchor elements would be adapted to their localized version, e.g. <a sfref="~/Home"> would resolve to <a href="en/Home">, but this is not the case.

    Similarly, how should links that are properties of user controls be handled? We currently use ResolveClientUrl, but this does not cater for the URL change to determine the language.

    If the properties have to be modified for each language, we have some user controls on our templates, but templates aren't localizable. Do you expect us to create a template for each language, and then change the template for each page's language?

    One thing that may solve all of this would be for you to implement the Session persistenceMode. When are you going to do this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    02 Feb 2010
    Link to this post
    Hi Paul Markham,

    Form Sitefinity 3.6 we use dynamic links, so that we do not have static url in the href or sfref attributes as you show. An example of dynamic links is shown below

    <a href="/EmptyProject/wiki1.aspx" sfref="[Sitefinity]77b9c8bf-dd63-4546-94dd-adcce2988b23">wiki1</a>

    If you type the links manually you should consider how the url will be formed. The templates for user controls have to be localized using standard ASP.NET methods as local resources.

    Pages and content items support localization and you have only to localize your custom controls.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. Paul Markham
    Paul Markham avatar
    19 posts
    Registered:
    02 Feb 2010
    02 Feb 2010
    Link to this post
    Thanks for the reply. I've just discovered dynamic links, and have been wondering how to implement these as properties in my user controls.

    I have found this blog posting - http://www.sitefinity.com/blogs/georgichokov/posts/09-07-02/resolving_the_url_of_dynamic_links.aspx - which provides a function to resolve a dynamic link to a real URL (although not from the normal dynamic link format - the function wants the provider and GUID as separate arguments), and someone has asked how to use a WebEditor on a dynamic link property of a user control.

    Can you provide any directions how to achieve this?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    02 Feb 2010
    Link to this post
    Hi Paul Markham,

    The method provided in the blog post returns the resolved url, so you have to assign it to the property you have or just call the method with the needed parameters.

    As for the WebEditor you can create a list of Content items  or ICmsPage objects from a given provider where you are returning the ID. You can take a look at the following sample that illustrates creating WebUITypeEditor

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  5. Paul Markham
    Paul Markham avatar
    19 posts
    Registered:
    02 Feb 2010
    02 Feb 2010
    Link to this post
    Is it not possible to re-use the PageId selector from the Dynamic Hyper Link control? I'd rather not re-invent the wheel!
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    02 Feb 2010
    Link to this post
    Hello Paul Markham,

    You can use something like this:
    [Category("Navigation"), DefaultValue(typeof(Guid), "00000000-0000-0000-0000-000000000000"),
        WebEditor("Telerik.Cms.Web.UI.DhlIdEditor, Telerik.Cms"),
        TypeConverter("Telerik.Cms.Web.UI.GuidTypeConverter, Telerik.Cms")]
        public Guid PageId
        {
            get
            {
                return this.pageId;
            }
            set
            {
                this.pageId = value;
            }
        }
        private Guid pageId;
        [DefaultValue(""), Category("Navigation"), UrlProperty, WebEditor("Telerik.Cms.Web.UI.DhlUrlEditor, Telerik.Cms"), Bindable(true)]
        public string NavigateUrl
        {
            get
            {
                return this.navigateUrl;
            }
            set
            {
                this.navigateUrl = value;
            }
        }
        private string navigateUrl;

    This will populate the page id property with the ID and the navigate url property with the page url automatically.

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  7. Paul Markham
    Paul Markham avatar
    19 posts
    Registered:
    02 Feb 2010
    02 Feb 2010
    Link to this post
    I've tried this and it works. The problem arises when more than one link is needed for a control.

    I've also tried implementing the custom WebUITypeEditor detailed at http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/09-10-27/creating_a_custom_webuitypeeditor.aspx. This almost works, but the page list runs off the bottom of the window.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    02 Feb 2010
    Link to this post
    Hello Paul Markham,

    You cannot use two selectors of type Telerik.Cms.Web.UI.DhlUrlEditor in the same category. You have to create two categories of properties or implement the selector from the blog post - there is a scroll in the window that you can use. You can also use another control in the template instead of RadTreeView.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  9. Paul Markham
    Paul Markham avatar
    19 posts
    Registered:
    02 Feb 2010
    03 Feb 2010
    Link to this post
    I'm interested in the possibility of using DhlUrlEditor on properties in different categories as suggested, but how do I get around the need to have multiple PageID and NavigateUrl properties?
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Feb 2010
    Link to this post
    Hello Paul Markham,

    You cannot have two WebEditors of type Telerik.Cms.Web.UI.DhlUrlEditor, Telerik.Cms. You have to create a new property and add it to different category using System.ComponentModel.Categor.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  11. Paul Markham
    Paul Markham avatar
    19 posts
    Registered:
    02 Feb 2010
    03 Feb 2010
    Link to this post
    Sorry, I don't understand. I understand you're saying I need properties in different categories (different System.ComponentModel.Category attribute), but the properties still need to have different names - I can't have two NavigateUrl properties in a class, regardless of them being in different categories.
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Feb 2010
    Link to this post
    Hi Paul Markham,

    Can't you rename them and then use each property in the correct place of your code?

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  13. Paul Markham
    Paul Markham avatar
    19 posts
    Registered:
    02 Feb 2010
    03 Feb 2010
    Link to this post
    They have to be called PageId and NavigateUrl in order to be able to use DhlUrlEditor!
Register for webinar
13 posts, 0 answered