ASPX templates
Version 5.x > ASPX templates > adding country/language selector View modes: 
User avatar
Member
Member
lightwork.info - 8/21/2011 10:36:04 PM
   
adding country/language selector
Hi,

I have a 2 different website with separate cms instance for HK & SG. How do I add new country into a languageselection webpart manually for each instance.

For example, in HK cms the default languageselection webpart when installed shows the existing culture of the cms which is default english and hk chinese. I wanted to add a singapore english link without adding a culture into the site manager coz the singapore english sits outside the hk cms, and is on a different machine.

Is it possible to modify the webpart and manually hand code the country name/flag and culture name for singapore?

something similar to IBM country drop down selector; http://www.ibm.com/planetwide/select/selector.html


Willy


User avatar
Member
Member
kentico_michal - 8/22/2011 3:04:02 AM
   
RE:adding country/language selector
Hello Willy,

Sure, you can do so in the SetupControl method (~\CMSWebParts\General\languageselectionwithflags.ascx.cs). Please see code marked as NEW CODE:


using (CachedSection<DataSet> cs = new CachedSection<DataSet>(ref ds, this.CacheMinutes, true, this.CacheItemName, "languageselection", CMSContext.CurrentSiteName))
{
if (cs.LoadData)
{
// Get the data
ds = CultureInfoProvider.GetSiteCultures(CMSContext.CurrentSiteName);

//NEW CODE
DataRow row = ds.Tables[0].NewRow();
row["CultureCode"] = "zh-HK";
row["CultureShortName"] = "Chinese";
ds.Tables[0].Rows.Add(row);
// END

// Save to the cache
if (cs.Cached)
{
cs.CacheDependency = CacheHelper.GetCacheDependency(new string[] { "cms.culturesite|all" });
cs.Data = ds;
}
}
}


Best regards,
Michal Legen