Example #1
0
        public void SaveInterfaceLanguage()
        {
            string sOldInterfaceLanguage = m_mediator.PropertyTable.GetStringProperty("CurrentInterfaceLanguage", "en");

            if (sOldInterfaceLanguage != m_sInterfaceLanguage)
            {
                m_mediator.PropertyTable.SetProperty("CurrentInterfaceLanguage", m_sInterfaceLanguage);
                string[] asTemp = new string[2];
                asTemp[0] = "CurrentInterfaceLanguage";
                asTemp[1] = m_sInterfaceLanguage;
                m_mediator.PropertyTable.Save("CabhabCurrentInterfaceLanguage", asTemp);
#if AfterHandleConfigMenuItemsGenerically
                CultureInfo ci = MiscUtils.GetCultureForWs(m_sInterfaceLanguage);
                if (ci != null)
                {
#if !__MonoCS__
                    FormLanguageSwitchSingleton.Instance.ChangeCurrentThreadUICulture(ci);
                    object mainWindowForm = m_mediator.PropertyTable.GetValue("window");
                    if (mainWindowForm != null)
                    {
                        FormLanguageSwitchSingleton.Instance.ChangeLanguage((Form)mainWindowForm);
                    }
#else
                    // TODO-Linux: Investigate FormLanguageSwitchSingleton
#endif
                }
                // Reload the mediator's string table with the appropriate language data.
                m_mediator.StringTbl.Reload(m_sInterfaceLanguage);
#endif
                object mainWindowForm = m_mediator.PropertyTable.GetValue("window");
                if (mainWindowForm != null)
                {
                    CabhabApp ca = mainWindowForm as CabhabApp;
                    ca.ReLoadMenuBarContents();
                }

                m_mediator.StringTbl.Reload("en");
            }
        }