protected void MakeTranslatable_Click(object sender, EventArgs e) { var t = new TabController(); var defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalId); t.LocalizeTab(_tab, defaultLocale); t.AddMissingLanguages(PortalId, _tab.TabID); t.ClearCache(PortalId); Response.Redirect(Request.RawUrl, false); }
private void ProcessLanguage(List<TabInfo> pageList, Locale locale, int languageCount, int totalLanguages) { var tabCtrl = new TabController(); RadProgressContext progress = RadProgressContext.Current; progress.Speed = "N/A"; progress.PrimaryTotal = totalLanguages; progress.PrimaryValue = languageCount; int total = pageList.Count; if (total == 0) { progress.SecondaryTotal = 0; progress.SecondaryValue = 0; progress.SecondaryPercent = 100; } for (int i = 0; i <= total - 1; i++) { TabInfo currentTab = pageList[i]; int stepNo = i + 1; progress.SecondaryTotal = total; progress.SecondaryValue = stepNo; float secondaryPercent = ((float) stepNo/(float) total) * 100; progress.SecondaryPercent = Convert.ToInt32(secondaryPercent); float primaryPercent = ((((float)languageCount + ((float)stepNo / (float)total)) / (float)totalLanguages)) * 100; progress.PrimaryPercent = Convert.ToInt32(primaryPercent); progress.CurrentOperationText = string.Format(Localization.GetString("ProcessingPage", LocalResourceFile), locale.Code, stepNo, total, currentTab.TabName); if (!Response.IsClientConnected) { //clear cache DataCache.ClearPortalCache(PortalId, true); //Cancel button was clicked or the browser was closed, so stop processing break; } progress.TimeEstimated = (total - stepNo)*100; if (locale.Code == PortalDefault) { tabCtrl.LocalizeTab(currentTab, locale, false); } else { tabCtrl.CreateLocalizedCopy(currentTab, locale, false); } } }