More in this section

Forums / Developing with Sitefinity / multilingual - hiding languages that dont have content yet?

multilingual - hiding languages that dont have content yet?

2 posts, 0 answered
  1. Meister
    Meister avatar
    262 posts
    09 Nov 2007
    24 Sep 2009
    Link to this post

    a client has 5 languages, but has only got the content in for 2 languages.
    they only want to show these 2 languages in the drop down on the front end, but still want to access the other languages in the backend so they can continue populating content.

    at the moment, when people visit from other countries the site redirects them to the versions of the site with no content (i.e. france)

    what is the solution for this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    24 Sep 2009
    Link to this post
    Hi Quade,

    There are two options that you could try.

    1. The LanguageList  control loads all cultures you have added in the web.config. You can create a custom user control that removes items from LanguageList control.

    sample code:

           LanguageList langList = this.FindControlRecursive(list1, "languageList1"as LanguageList;  
            string removeCulture = "fr";  
            for(  int i = langList .Items.Count-1 ; i >= 0 ; i-- )  
                ListItem li = langList .Items[i];  
                if (li.Value == removeCulture )  
                    langList .Items.RemoveAt(i);  

    If necessary you can get all cultures defined in your web.config using LocalizationManager class.

    2. Create custom HttpModule that handles the requests and redirects your user to the default language. You can get the current request using HttpContext. You can get the culture using CultireInfo class.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered