Beispiel #1
0
        public void Dispose()
        {
            if (_securityDisabler != null)
            {
                _securityDisabler.Dispose();
                _securityDisabler = null;
            }

            if (_siteContextSwitcher != null)
            {
                _siteContextSwitcher.Dispose();
                _siteContextSwitcher = null;
            }

            if (_languageSwitcher != null)
            {
                _languageSwitcher.Dispose();
                _languageSwitcher = null;
            }

            if (_databaseSwitcher != null)
            {
                _databaseSwitcher.Dispose();
                _databaseSwitcher = null;
            }

            if (_userSwitcher != null)
            {
                _userSwitcher.Dispose();
                _userSwitcher = null;
            }
        }
Beispiel #2
0
        public ActionResult LstLanguages()
        {
            LanguageSwitcher ls = new LanguageSwitcher();

            Appleseed.Framework.Web.UI.WebControls.LanguageCultureCollection lcc = Appleseed.Framework.Localization.LanguageSwitcher.GetLanguageCultureList();


            List <string[]> datos          = new List <string[]>();
            var             settings       = PortalSettings.HasEnablePageFriendlyUrl(Portal.PageID, Config.DefaultPortal);
            var             pageextenstion = System.Configuration.ConfigurationManager.AppSettings["friendlyUrlExtension"];

            foreach (Appleseed.Framework.Web.UI.WebControls.LanguageCultureItem l in lcc)
            {
                string[] dato  = new string[3];
                string   aux   = l.ToString();
                char[]   array = new char[1];
                array[0] = '/';
                string[] lang = aux.Split(array);

                dato[0] = settings == true?HttpUrlBuilder.BuildUrl("~/Home" + pageextenstion + "?lang=" + lang[0]) : HttpUrlBuilder.BuildUrl("~/site/0/Home?lang=" + lang[0]);

                LanguageSwitcher lswitcher = new LanguageSwitcher();
                dato[1] = lswitcher.GetFlagImgLCI(l);
                dato[1] = dato[1].Replace("images", "~/aspnet_client");

                dato[1] = HttpUrlBuilder.BuildUrl(dato[1]);

                dato[2] = lswitcher.getNameLCI(l);
                datos.Add(dato);
            }

            ViewData["datos"] = datos;
            return(View());
        }
Beispiel #3
0
        public ActionResult LstLanguages()
        {
            LanguageSwitcher ls = new LanguageSwitcher();

            Appleseed.Framework.Web.UI.WebControls.LanguageCultureCollection lcc = Appleseed.Framework.Localization.LanguageSwitcher.GetLanguageCultureList();


            List <string[]> datos = new List <string[]>();

            foreach (Appleseed.Framework.Web.UI.WebControls.LanguageCultureItem l in lcc)
            {
                string[] dato  = new string[3];
                string   aux   = l.ToString();
                char[]   array = new char[1];
                array[0] = '/';
                string[] lang = aux.Split(array);

                dato[0] = HttpUrlBuilder.BuildUrl("~/site/0/Home?lang=" + lang[0]);

                LanguageSwitcher lswitcher = new LanguageSwitcher();
                dato[1] = lswitcher.GetFlagImgLCI(l);
                dato[1] = dato[1].Replace("images", "~/aspnet_client");

                dato[1] = HttpUrlBuilder.BuildUrl(dato[1]);

                dato[2] = lswitcher.getNameLCI(l);
                datos.Add(dato);
            }

            ViewData["datos"] = datos;
            return(View());
        }
Beispiel #4
0
        /// <inheritdoc/>
        public void Display()
        {
            bool run = true;

            while (run)
            {
                var currentClient = _authService.GetCurrentClient();
                if (currentClient != null)
                {
                    _outputEnvironment.WriteLine($"{Resource.Hello}, {currentClient}");
                    _outputEnvironment.WriteLine(new string('-', 30));
                }

                var mainMenu = _menuVisualizer.FactoryMethod();
                mainMenu.Add(_authService.GetCurrentClientId().HasValue ? Resource.Logout : Resource.Login, () => LoginLogout())
                .Add(Resource.ClientMenu, () => _clientPage.Display())
                .Add(Resource.BookMenu, () => _bookPage.Display())
                .Add(Resource.Settings, () => _settingsPage.Display())
                .Add(Resource.SwitchLanguage, () => LanguageSwitcher.Switch())
                .Add(Resource.Exit, () => run = false);

                mainMenu.Display();

                _outputEnvironment.WriteLine(new string('-', 30));
            }
        }
Beispiel #5
0
        public IEnumerator ReloadEdition()
        {
            LanguageSwitcher = new LanguageSwitcher();
            yield return(LanguageSwitcher.LoadData());

            DB = new DatabaseManager(true);
            yield return(LanguageSwitcher.PreloadLocalizedDataCO());
        }
 void Start()
 {
     saveSystem       = FindObjectOfType <SaveSystem>();
     languageSwitcher = FindObjectOfType <LanguageSwitcher>();
     currentImage     = GetComponent <SpriteRenderer>();
     languageENUi     = Resources.Load <Sprite>(languageENName);
     languageRUUI     = Resources.Load <Sprite>(languageRUName);
     SetButtonOptions();
 }
Beispiel #7
0
 private void Awake()
 {
     if (_instance != null)
     {
         Logger.Warning("LanguageSwitcher should only be attached once.");
         return;
     }
     _instance = this;
 }
Beispiel #8
0
 public void InitializeModule()
 {
     if (Settings.Default.CurrentLanguage == null)
     {
         Settings.Default.CurrentLanguage = Thread.CurrentThread.CurrentUICulture.Name;
     }
     switcher              = new LanguageSwitcher("/ClearMine.Localization;component/{0}/Overall.xaml", new[] { typeof(string), typeof(ImageSource) }, true);
     switcher.Initialized += OnLanguageSwitcherInitailized;
     MessageManager.SubscribeMessage <UIComponentLoadedMessage>(OnUIComponentLoaded);
 }
Beispiel #9
0
        public Settings()
        {
            this.InitializeComponent();
            ThemeSwitcher themeSwitcher = new ThemeSwitcher();

            themeSwitcherUI.DataContext = themeSwitcher;
            LanguageSwitcher languageSwitcher = new LanguageSwitcher();

            languageSwitcherUI.DataContext = languageSwitcher;
        }
Beispiel #10
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var currentUICulture  = CultureInfo.CurrentUICulture;
            var currentController = HttpContext.Request.RouteValues["controller"].ToString();
            var currentAction     = HttpContext.Request.RouteValues["action"].ToString();
            var urlPattern        = String.Empty;

            if (HttpContext.Request.RouteValues["url_pattern"] != null)
            {
                urlPattern = HttpContext.Request.RouteValues["url_pattern"].ToString();
            }

            LocalizationDirection translationDirection = LocalizationDirection.TranslatedToOriginal;

            var cultureOptions = new List <LanguageSwitcherOption>();

            foreach (CultureInfo ci in _localizationOptions.Value.SupportedCultures)
            {
                if (ci.Name != DefaultCulture)
                {
                    translationDirection = LocalizationDirection.OriginalToTranslated;
                }

                var translation = await _localizedRoutingProvider.ProvideRouteAsync(
                    ci.Name,
                    currentController,
                    currentAction,
                    translationDirection);

                var option = new LanguageSwitcherOption
                {
                    DisplayName          = ci.NativeName.Substring(0, ci.NativeName.IndexOf("(")),
                    CultureCode          = ci.Name,
                    TranslatedController = translation.Controller,
                    TranslatedAction     = translation.Action,
                    UrlPattern           = urlPattern
                };

                cultureOptions.Add(option);
            }

            var languageSwitcher = new LanguageSwitcher
            {
                CurrentUICulture = currentUICulture,
                CultureOptions   = cultureOptions
            };

            return(View("languageSelector", languageSwitcher));
        }
Beispiel #11
0
        public ReportContext(string userName = "******", string siteName = "shell", string databaseName = "master", string language = null)
        {
            var user = User.FromName(userName, false);

            _userSwitcher     = new UserSwitcher(user);
            _databaseSwitcher = new DatabaseSwitcher(Sitecore.Configuration.Factory.GetDatabase(databaseName));

            if (!string.IsNullOrEmpty(language))
            {
                _languageSwitcher = new LanguageSwitcher(language);
            }

            _siteContextSwitcher = new SiteContextSwitcher(SiteContextFactory.GetSiteContext(siteName));
            _securityDisabler    = new SecurityDisabler();
        }
Beispiel #12
0
        //public LayerMask JinnLayerMask;
        void Start()
        {
            // Debug.Log(JinnLayerMask.value);
            MainCam = GetComponent <Camera>();
            Application.targetFrameRate = 60;
            int minutes = (int)(GameManager.TimeLeft / 60);

            Timer.text = (language == (int)Language.Arabic ? "ﻲﻘﺒﺘﻣ ﻦﻣﺯ " : "Time Left ") + minutes + ":" + (GameManager.TimeLeft - minutes * 60).ToString("00");
            switcher   = GetComponent <LanguageSwitcher>();
            switcher.Initilize();
            GameManager.Init(MainCam, Jinn, Man, Wolf, ObjectsParent, FearImage, WinLoseText, WinLoseUI);
            ParticleManager.Initilaize(ParticleParent);
            AudioManager.Initilaize(AudioParent, audioMixer);
            ChangeLanguage(language);
            SettingsUI.SetActive(true);
            WinLoseUI.SetActive(false);
        }
Beispiel #13
0
        public void ChangeLanguage(int newLanguage)
        {
            if (switcher == null)
            {
                switcher = GetComponent <LanguageSwitcher>();
            }

            language = newLanguage;
            string Start    = language == 0 ? "أﺪﺑﺍ" : "Start";
            string Continue = language == 0 ? "ﻊﺑﺎﺗ" : "Continue";

            FearText             = language == 0 ? "نﺎﺴﻧﻻﺍ فﻮﺧ: " : "Human Fear: ";
            SinText              = language == 0 ? "نﺎﺴﻧﻻﺍ ﺐﻧﺫ: " : "Human Sin: ";
            MoodText             = language == 0 ? "نﺎﺴﻧﻻﺍ جﺍﺰﻣ: " : "Human Mood: ";
            JinnPowerText        = language == 0 ? "ﻲﻨﺠﻟﺍ ةﻮﻗ" : "Jinn Power: ";
            WolfMoodText         = language == 0 ? "ﺐﺋﺬﻟﺍ جﺍﺰﻣ" : "Wolf Mood: ";
            SettingsText.text    = StartedGame ? Continue : Start;
            RestartGameText.text = language == 0 ? "ىﺮﺧﺍ هﺮﻣ ﺐﻌﻟﺍ" : "Play Again";
            TextAnchor anchor = language == 0 ? TextAnchor.UpperRight : TextAnchor.UpperLeft;

            //GameDescription
            GameDescription.text      = switcher.GameDescription[language];
            GameDescription.alignment = anchor;
            //Ablitiy Titles and Descriptions
            Ablility0Title.text = switcher.Abilitiy0Title[language];
            Ablility1Title.text = switcher.Abilitiy1Title[language];
            Ablility2Title.text = switcher.Abilitiy2Title[language];
            Ablility3Title.text = switcher.Abilitiy3Title[language];

            Ablility0Desc.text = switcher.Abilitiy0Desc[language];
            Ablility1Desc.text = switcher.Abilitiy1Desc[language];
            Ablility2Desc.text = switcher.Abilitiy2Desc[language];
            Ablility3Desc.text = switcher.Abilitiy3Desc[language];

            // Ablility0Desc.alignment = anchor;
            // Ablility1Desc.alignment = anchor;
            // Ablility2Desc.alignment = anchor;
            // Ablility3Desc.alignment = anchor;

            int minutes = (int)(GameManager.TimeLeft / 60);

            //TimerUpdate
            Timer.text = (language == (int)Language.Arabic ? "ﻲﻘﺒﺘﻣ ﻦﻣﺯ " : "Time Left ") + minutes + ":" + (GameManager.TimeLeft - minutes * 60).ToString("00");
        }
Beispiel #14
0
        /// <summary>
        /// Changed by [email protected]
        ///   Page are different for custom page layout an theme, this cannot be static
        ///   Added by [email protected]
        ///   Cache by Manu
        ///   non static function, Thierry : this is necessary for page custom layout and themes
        /// </summary>
        /// <returns>
        /// A System.Collections.Hashtable value...
        /// </returns>
        private Dictionary <string, ISettingItem> GetPageBaseSettings()
        {
            // Define base settings
            var baseSettings = new Dictionary <string, ISettingItem>();

            // 2_aug_2004 Cory Isakson
            var groupOrderBase = (int)SettingItemGroup.NAVIGATION_SETTINGS;
            var group          = SettingItemGroup.NAVIGATION_SETTINGS;

            var tabPlaceholder = new SettingItem <bool, CheckBox>(new BaseDataType <bool, CheckBox>())
            {
                Group       = group,
                Order       = groupOrderBase,
                Value       = false,
                EnglishName = "Act as a Placeholder?",
                Description = "Allows this tab to act as a navigation placeholder only."
            };

            baseSettings.Add("TabPlaceholder", tabPlaceholder);

            var tabLink = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                Value       = string.Empty,
                Order       = groupOrderBase + 1,
                EnglishName = "Static Link URL",
                Description = "Allows this tab to act as a navigation link to any URL."
            };

            baseSettings.Add("TabLink", tabLink);

            var tabUrlKeyword = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                Order       = groupOrderBase + 2,
                EnglishName = "URL Keyword",
                Description = "Allows you to specify a keyword that would appear in your URL."
            };

            baseSettings.Add("TabUrlKeyword", tabUrlKeyword);

            var urlPageName = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                Order       = groupOrderBase + 3,
                EnglishName = "URL Page Name",
                Description =
                    "This setting allows you to specify a name for this tab that will show up in the URL instead of default.aspx"
            };

            baseSettings.Add("UrlPageName", urlPageName);

            var PageList       = new ArrayList(new PagesDB().GetPagesFlat(this.PortalSettings.PortalID));
            var noSelectedPage = new PageItem {
                Name = General.GetString("NONE"), ID = -1
            };

            PageList.Insert(0, noSelectedPage);


            var FB_LikeGate_Page = new SettingItem <string, ListControl>(new CustomListDataType(PageList, "Name", "ID"))
            {
                Group       = group,
                Order       = groupOrderBase + 4,
                EnglishName = "FB Like Gate Page",
                Description =
                    "This setting allows you to specify an url to redirect if the user doesn't like your page"
            };

            baseSettings.Add("FB_LikeGate_Page", FB_LikeGate_Page);

            // groupOrderBase = (int)SettingItemGroup.META_SETTINGS;
            group = SettingItemGroup.META_SETTINGS;
            var tabTitle = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Title",
                Description =
                    "Allows you to enter a title (Shows at the top of your browser) for this specific Tab / Page. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabTitle", tabTitle);

            var tabMetaKeyWords = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Keywords",
                Description =
                    "This setting is to help with search engine optimization. Enter 1-15 Default Keywords that represent what this Tab / Page is about.Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabMetaKeyWords", tabMetaKeyWords);
            var tabMetaDescription = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Description",
                Description =
                    "This setting is to help with search engine optimization. Enter a description (Not too long though. 1 paragraph is enough) that describes this particular Tab / Page. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabMetaDescription", tabMetaDescription);
            var tabMetaEncoding = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Encoding",
                Description =
                    "Every time your browser returns a page it looks to see what format it is retrieving. This allows you to specify the content type for this particular Tab / Page. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabMetaEncoding", tabMetaEncoding);
            var tabMetaOther = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Additional Meta Tag Entries",
                Description =
                    "This setting allows you to enter new tags into this Tab / Page's HEAD Tag. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabMetaOther", tabMetaOther);
            var tabKeyPhrase = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Keyphrase",
                Description =
                    "This setting can be used by a module or by a control. It allows you to define a message/phrase for this particular Tab / Page This can be used for search engine optimisation. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabKeyPhrase", tabKeyPhrase);

            // changed Thierry (Tiptopweb) : have a dropdown menu to select layout and themes
            groupOrderBase = (int)SettingItemGroup.THEME_LAYOUT_SETTINGS;
            group          = SettingItemGroup.THEME_LAYOUT_SETTINGS;

            // get the list of available layouts
            // changed: Jes1111 - 2004-08-06
            var layoutsList = new ArrayList(new LayoutManager(this.PortalSettings.PortalPath).GetLayouts());


            var noCustomLayout = new LayoutItem {
                Name = General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)")
            };

            layoutsList.Insert(0, noCustomLayout);

            // get the list of available themes
            // changed: Jes1111 - 2004-08-06
            var themesList    = new ArrayList(new ThemeManager(this.PortalSettings.PortalPath).GetThemes());
            var noCustomTheme = new ThemeItem {
                Name = General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)")
            };

            themesList.Insert(0, noCustomTheme);

            // changed: Jes1111 - 2004-08-06
            var customLayout = new SettingItem <string, ListControl>(new CustomListDataType(layoutsList, "Name", "Name"))
            {
                Group       = group,
                Order       = groupOrderBase + 11,
                EnglishName = "Custom Layout",
                Description = "Set a custom layout for this tab only"
            };

            baseSettings.Add("CustomLayout", customLayout);

            // SettingItem CustomTheme = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>());
            // changed: Jes1111 - 2004-08-06
            var customTheme = new SettingItem <string, ListControl>(new CustomListDataType(themesList, "Name", "Name"))
            {
                Group       = group,
                Order       = groupOrderBase + 12,
                EnglishName = "Custom Theme",
                Description = "Set a custom theme for the modules in this tab only"
            };

            baseSettings.Add("CustomTheme", customTheme);

            // SettingItem CustomThemeAlt = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>());
            // changed: Jes1111 - 2004-08-06
            var customThemeAlt = new SettingItem <string, ListControl>(
                new CustomListDataType(themesList, "Name", "Name"))
            {
                Group       = group,
                Order       = groupOrderBase + 13,
                EnglishName = "Custom Alt Theme",
                Description = "Set a custom alternate theme for the modules in this tab only"
            };

            baseSettings.Add("CustomThemeAlt", customThemeAlt);

            var customMenuImage =
                new SettingItem <string, ListControl>(new CustomListDataType(this.GetImageMenu(), "Key", "Value"))
            {
                Group       = group,
                Order       = groupOrderBase + 14,
                EnglishName = "Custom Image Menu",
                Description = "Set a custom menu image for this tab"
            };

            baseSettings.Add("CustomMenuImage", customMenuImage);

            groupOrderBase = (int)SettingItemGroup.CULTURE_SETTINGS;
            group          = SettingItemGroup.CULTURE_SETTINGS;
            var cultureList = LanguageSwitcher.GetLanguageList(true);

            // Localized tab title
            var counter = groupOrderBase + 11;

            // Ignore invariant
            foreach (
                var c in cultureList.Where(c => c != CultureInfo.InvariantCulture && !baseSettings.ContainsKey(c.Name)))
            {
                var localizedTabKeyPhrase = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
                {
                    Order       = counter,
                    Group       = group,
                    EnglishName = string.Format("Tab Key Phrase ({0})", c.Name),
                    Description = string.Format("Key Phrase this Tab/Page for {0} culture.", c.EnglishName)
                };
                baseSettings.Add(string.Format("TabKeyPhrase_{0}", c.Name), localizedTabKeyPhrase);
                var localizedTitle = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
                {
                    Order       = counter,
                    Group       = group,
                    EnglishName = string.Format("Title ({0})", c.Name),
                    Description = string.Format("Set title for {0} culture.", c.EnglishName)
                };
                baseSettings.Add(c.Name, localizedTitle);
                counter++;
            }

            return(baseSettings);
        }
 void Awake()
 {
     ls = GetComponentInParent <LanguageSwitcher>();
 }
Beispiel #16
0
 public override void Initialize()
 {
     MessageManager.SubscribeMessage <GameStateMessage>(OnGameStateChanged);
     MessageManager.SubscribeMessage <UserOperationMessage>(OnUserOperation);
     switcher = new LanguageSwitcher("/ClearMine.Plugin.AudioPlayer;component/Localization/{0}.xaml", new[] { typeof(string) }, false);
 }