public static string TryGetLocalizedTabName(int tabId, string defaultTabName)
        {
            LocalizedTabInfo localizedTab = GetLocalizedTab(tabId, PortalSettings.Current.PortalId, true);

            if (localizedTab != null)
            {
                string localizedTabName = localizedTab.TabLocalizedTabName;
                if (!string.IsNullOrEmpty(localizedTabName))
                {
                    return(localizedTabName);
                }
            }

            return(defaultTabName);
        }
        public static LocalizedTabInfo GetLocalizedTab(int tabId, int portalId, bool fromCache)
        {
            TabInfo tabInfo = TabController.Instance.GetTab(tabId, portalId);

            if (tabInfo == null)
            {
                return(null);
            }
            else if (fromCache)
            {
                return(GetLocalizedTab(tabInfo, true));
            }
            else
            {
                var tabController = new TabLocaleController();
                var localizedTab  = new LocalizedTabInfo(tabInfo.Clone())
                {
                    LocaleList = tabController.GetListByTabID(tabId).ToList()
                };
                return(localizedTab);
            }
        }
        /// <summary>
        /// Loads localized TabInfos from the actual visible tabs for a given portal id.
        /// System Tabs and Admin Tabs are excluded from the result set.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public static List <LocalizedTabInfo> GetLocalizedTabs(bool fromCache)
        {
            string cacheKey    = string.Format(Constants.LocalizedTabsCacheKey, PortalSettings.Current.PortalId);
            var    cacheObject = fromCache ? DataCache.GetCache(cacheKey) : null;

            if (cacheObject != null)
            {
                return((List <LocalizedTabInfo>)cacheObject);
            }
            else
            {
                var localizedTabs = new List <LocalizedTabInfo>();
                var allTabLocales = new TabLocaleController().GetAll().ToList();
                //Dictionary<int, TabInfo> tabInfos = TabController.Instance.GetTabsByPortal(PortalSettings.Current.PortalId);
                Dictionary <int, TabInfo> tabInfos = TabController.Instance.GetUserTabsByPortal(PortalSettings.Current.PortalId);

                foreach (TabInfo dnnTab in tabInfos.Values)
                {
                    var tabInfo = new LocalizedTabInfo(dnnTab.Clone());

                    if (allTabLocales != null && allTabLocales.Count > 0)
                    {
                        tabInfo.LocaleList = allTabLocales.Where(x => x.TabID == tabInfo.TabID).ToList();
                    }

                    localizedTabs.Add(tabInfo);
                }

                if (fromCache)
                {
                    DataCache.SetCache(cacheKey, localizedTabs);
                }

                return(localizedTabs);
            }
        }
        /// <summary>
        /// Get localized TabInfo
        /// </summary>
        /// <param name="tabInfo"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static LocalizedTabInfo GetLocalizedTab(TabInfo tabInfo, bool fromCache = true)
        {
            LocalizedTabInfo localizedTab = MatchLocaleTabToTab(tabInfo, GetLocalizedTabs(fromCache));

            return(localizedTab ?? new LocalizedTabInfo(tabInfo));
        }