public void SetCurrentLanguage(int languageSelected)
    {
        if (languageSelected == LanguageUtility.GetCurrentLanguage())
        {
            return;
        }

        localeManager = FindObjectOfType <LocalizationManager>() as LocalizationManager;
        LanguageUtility.Language selected = (LanguageUtility.Language)languageSelected;
        foreach (var item in selectedColors)
        {
            item.enabled = false;
        }

        switch (selected)
        {
        case LanguageUtility.Language.Finnish:
            selectedColors[0].enabled = true;
            LanguageUtility.SetCurrentLanguage((int)selected);
            localeManager.LoadLocale("localizedText_fi.json");
            break;

        case LanguageUtility.Language.English:
            selectedColors[1].enabled = true;
            LanguageUtility.SetCurrentLanguage((int)selected);
            localeManager.LoadLocale("localizedText_en.json");
            break;

        default:
            break;
        }
    }
Beispiel #2
0
        public void InitPageLanguage()
        {
            if (Request.QueryString["language"] == null)
            {
                Page.Response.Redirect("/" + LanguageSetting.Setting.DefaultLanguage.Substring(0, 2) + PageDefinition.FE_HOME);
            }
            var language = Request.QueryString["language"];

            if (language.Equals(LanguageUtility.GetCurrentLanguage().Substring(0, 2)))
            {
                return;
            }
            if (language.Equals(LanguageSetting.Setting.DefaultLanguage.Substring(0, 2)))
            {
                LanguageUtility.SetCurrentUILanguage(LanguageSetting.Setting.DefaultLanguage);
                LanguageUtility.SetCurrentLanguage(LanguageSetting.Setting.DefaultLanguage);
                Page.Response.Redirect(Request.Url.AbsolutePath, true);
            }
            else
            {
                LanguageUtility.SetCurrentUILanguage(LanguageSetting.Setting.SecondLanguage);
                LanguageUtility.SetCurrentLanguage(LanguageSetting.Setting.SecondLanguage);
                Page.Response.Redirect(Request.Url.AbsolutePath, true);
            }
        }