Exemple #1
0
        public void LoadLanguage(int langCode)
        {
            if (langCode != LangMan.LS_DEF_CODE)
            {
                bool loaded = false;

                foreach (LangRecord langRec in fLanguages)
                {
                    if (langRec.Code == langCode)
                    {
                        loaded = LangMan.LoadFromFile(langRec.FileName);
                        break;
                    }
                }

                if (!loaded)
                {
                    langCode = LangMan.LS_DEF_CODE;
                }
            }

            if (langCode == LangMan.LS_DEF_CODE)
            {
                LangMan.DefInit();
            }

            fInterfaceLang = (ushort)langCode;
        }
Exemple #2
0
        public void LoadLanguage(int langCode)
        {
            try
            {
                if (langCode <= 0)
                {
                    langCode = RequestLanguage();
                }

                if (langCode != LangMan.LS_DEF_CODE)
                {
                    bool loaded = false;

                    foreach (LangRecord langRec in AppHost.Options.Languages)
                    {
                        if (langRec.Code == langCode)
                        {
                            loaded = LangMan.LoadFromFile(langRec.FileName);
                            break;
                        }
                    }

                    if (!loaded)
                    {
                        langCode = LangMan.LS_DEF_CODE;
                    }
                }

                if (langCode == LangMan.LS_DEF_CODE)
                {
                    LangMan.DefInit();
                }

                AppHost.Options.InterfaceLang = (ushort)langCode;
                AppHost.Plugins.OnLanguageChange();

                UpdateLang();
            }
            catch (Exception ex)
            {
                Logger.LogWrite("AppHost.LoadLanguage(): " + ex.Message);
            }
        }