Skip to main content
added 768 characters in body
Source Link

We are developing a multi regional and multilingual site in sitecore 8.2

We have following URL structure:

www.local.com/ar-bh
www.local.com/en-bh

www.local.com/ar-kw
www.local.com/en-kw

and following sites definition in sitecore.config

<site name="Bahrain" hostname="sitecore/" virtualFolder="/en-bh" physicalFolder="/en-bh" rootPath="/sitecore/content" startItem="/Bahrain" database="master" domain="extranet" language ="en"/>

<site name="Bahrain_Arabic" hostname="sitecore/" virtualFolder="/ar-bh" physicalFolder="/ar-bh" rootPath="/sitecore/content" startItem="/Bahrain" database="master" domain="extranet" language ="ar"/>

and

<setting name="Languages.AlwaysStripLanguage" value="false"/>

Sites are working perfectly, but I am having issues in language switcher, I need suggestion from experts what would be the optimal way to achieve this. Each regional site has two languages English and Arabic.

I am using following code to change site context

    var myItem = Sitecore.Context.Item;
    string siteurl = string.Empty;
    var sitesList = Sitecore.Configuration.Factory.GetSiteInfoList();
    var currentSiteName = Sitecore.Context.GetSiteName();
    var website = Sitecore.Configuration.Factory.GetSite("Bahrain_arabic");
    using (new Sitecore.Sites.SiteContextSwitcher(website))
    {
        var options = LinkManager.GetDefaultUrlOptions();
        options.AlwaysIncludeServerUrl = true;
        options.SiteResolving = true;
        siteurl = LinkManager.GetItemUrl(myItem, options);
    }   

LinkManager is always returning the current site url, I am lookin for some dynamic solution.

We are developing a multi regional and multilingual site in sitecore 8.2

We have following URL structure:

www.local.com/ar-bh
www.local.com/en-bh

www.local.com/ar-kw
www.local.com/en-kw

and following sites definition in sitecore.config

<site name="Bahrain" hostname="sitecore/" virtualFolder="/en-bh" physicalFolder="/en-bh" rootPath="/sitecore/content" startItem="/Bahrain" database="master" domain="extranet" language ="en"/>

<site name="Bahrain_Arabic" hostname="sitecore/" virtualFolder="/ar-bh" physicalFolder="/ar-bh" rootPath="/sitecore/content" startItem="/Bahrain" database="master" domain="extranet" language ="ar"/>

and

<setting name="Languages.AlwaysStripLanguage" value="false"/>

Sites are working perfectly, but I am having issues in language switcher, I need suggestion from experts what would be the optimal way to achieve this. Each regional site has two languages English and Arabic.

We are developing a multi regional and multilingual site in sitecore 8.2

We have following URL structure:

www.local.com/ar-bh
www.local.com/en-bh

www.local.com/ar-kw
www.local.com/en-kw

and following sites definition in sitecore.config

<site name="Bahrain" hostname="sitecore/" virtualFolder="/en-bh" physicalFolder="/en-bh" rootPath="/sitecore/content" startItem="/Bahrain" database="master" domain="extranet" language ="en"/>

<site name="Bahrain_Arabic" hostname="sitecore/" virtualFolder="/ar-bh" physicalFolder="/ar-bh" rootPath="/sitecore/content" startItem="/Bahrain" database="master" domain="extranet" language ="ar"/>

and

<setting name="Languages.AlwaysStripLanguage" value="false"/>

Sites are working perfectly, but I am having issues in language switcher, I need suggestion from experts what would be the optimal way to achieve this. Each regional site has two languages English and Arabic.

I am using following code to change site context

    var myItem = Sitecore.Context.Item;
    string siteurl = string.Empty;
    var sitesList = Sitecore.Configuration.Factory.GetSiteInfoList();
    var currentSiteName = Sitecore.Context.GetSiteName();
    var website = Sitecore.Configuration.Factory.GetSite("Bahrain_arabic");
    using (new Sitecore.Sites.SiteContextSwitcher(website))
    {
        var options = LinkManager.GetDefaultUrlOptions();
        options.AlwaysIncludeServerUrl = true;
        options.SiteResolving = true;
        siteurl = LinkManager.GetItemUrl(myItem, options);
    }   

LinkManager is always returning the current site url, I am lookin for some dynamic solution.

Source Link

Sitecore Multi Regional and Multilingual Site Language Swicther

We are developing a multi regional and multilingual site in sitecore 8.2

We have following URL structure:

www.local.com/ar-bh
www.local.com/en-bh

www.local.com/ar-kw
www.local.com/en-kw

and following sites definition in sitecore.config

<site name="Bahrain" hostname="sitecore/" virtualFolder="/en-bh" physicalFolder="/en-bh" rootPath="/sitecore/content" startItem="/Bahrain" database="master" domain="extranet" language ="en"/>

<site name="Bahrain_Arabic" hostname="sitecore/" virtualFolder="/ar-bh" physicalFolder="/ar-bh" rootPath="/sitecore/content" startItem="/Bahrain" database="master" domain="extranet" language ="ar"/>

and

<setting name="Languages.AlwaysStripLanguage" value="false"/>

Sites are working perfectly, but I am having issues in language switcher, I need suggestion from experts what would be the optimal way to achieve this. Each regional site has two languages English and Arabic.