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

Forums / General Discussions / LanguageSelector: Order of Appearance

LanguageSelector: Order of Appearance

6 posts, 0 answered
  1. Carl Anderson
    Carl Anderson avatar
    27 posts
    Registered:
    26 Jun 2012
    26 May 2011
    Link to this post
    Hi,

    I've got a LanguageSelector widget in a page template used by all my pages.
    I have two languages enabled, and translatations in each for all my pages.
    The problem I experience is that the order in which languages appear vary from one page to another. For instance, on my home page I have "français" and then "English", but if I navigate on another page I get "English" first, and "français" second.

    Any ideas on how to fix this?

    Regards,
    Carl
  2. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    30 May 2011
    Link to this post
    Hi Carl,

    Can you tell me what steps you followed when adding translation to the pages?

    I could not reproduce the problem when:

    1. Create a page in English.
    2. Create page # 2 in English.
    3. Added French to page#1, when asked if I want to sync the pages, said OK, and ticked the box in the popup.
    4. Same for page#2.
    5. Dropped the Language widget, checked the box where it says: Include current language in the selector. ( check attached screenshot )
    6. Same for page#2.

    Finally when I was browsing the pages the order of translations did not change in the widget.

    All the best,
    Victor Velev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Goulutor
    Goulutor avatar
    5 posts
    Registered:
    08 Sep 2011
    29 Sep 2011
    Link to this post
    Hi,
    I've the exactly the same problem now. Can you tell me how did you fix that ?

    Thanks

    Regards
    Julien
  4. Carl Anderson
    Carl Anderson avatar
    27 posts
    Registered:
    26 Jun 2012
    30 Sep 2011
    Link to this post
    Hi,

    Since it was at the very beginning of my project, I started over a new site and the problem didn't show up this time..

    Carl
  5. Goulutor
    Goulutor avatar
    5 posts
    Registered:
    08 Sep 2011
    30 Sep 2011
    Link to this post
    Since I don't want to re-create all pages of my sites, I found another solution using a custom template for Language Selector Control widget. Here is the code I'm successfully using:

    public class LanguageSelectorControl : Telerik.Sitefinity.Localization.Web.UI.LanguageSelectorControl
        {
            private List<string> languagesOrder;
            private List<string> LanguagesOrder
            {
                get
                {
                    if (languagesOrder == null)
                    {
                        try
                        {
                            languagesOrder = ConfigurationManager.AppSettings.Get("LanguagesOrder").Split(',').ToList();
                        }
                        catch (Exception ex)
                        {
                            languagesOrder = "fr,de,it,en".Split(',').ToList();
                        }
                    }
                    return languagesOrder;
                }
            }
     
            protected override IEnumerable<CultureInfo> GetLanguagesToDisplay()
            {
                return base.GetLanguagesToDisplay().OrderBy(o => LanguagesOrder.IndexOf(o.TwoLetterISOLanguageName));
            }
        }

    Julien
  6. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    30 Sep 2011
    Link to this post
    Hello Julien,

    Can you please provide more information about your project as well as which version of Sitefinity do you use. In our latest service pack 4.1 there were many fixes including such for ML support, so could you try and reproduce the issue ( and provide steps ) with our latest release?

    Regards,
    Victor Velev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
6 posts, 0 answered