Example #1
0
        private static void SetLanguage(Language language)
        {
            var tag = EnumCache <Language> .Description(language);

            if (LanguageTag == tag)
            {
                return;
            }

            Language    = language;
            LanguageTag = tag;

            Roots.ForEach(menu => menu.UpdateTranslations());

            OnLanguageChanged.SafeInvoke(EventArgs.Empty);
        }
Example #2
0
        /// Loads the categories
        ///
        private void LoadCategories()
        {
            m_loader.Clear();

            int loaded    = 0;
            var resources = GetResourcesForLanguage(m_language);

            foreach (var resource in resources)
            {
                m_loader.LoadResource(resource.Key, resource.Value, () =>
                {
                    ++loaded;
                    if (loaded == resources.Count)
                    {
                        m_loaded = true;
                        PlayerPrefs.SetString(LocalisedTextIdentifiers.k_languageSettings, m_language.ToString());
                        PlayerPrefs.Save();
                        OnLanguageChanged.SafeInvoke();
                    }
                });
            }
        }