Ejemplo n.º 1
0
        public bool TryGetLanguage(string languageName, ref LeanLanguage language)
        {
            if (languages != null)
            {
                for (var i = languages.Count - 1; i >= 0; i--)
                {
                    language = languages[i];

                    if (language.Name == languageName)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>This adds a new language to this LeanLocalization instance, with the specified name and cultures.</summary>
        public LeanLanguage AddLanguage(string languageName, string[] cultures)
        {
            var language = default(LeanLanguage);

            if (TryGetLanguage(languageName, ref language) == false)
            {
                language = new LeanLanguage();

                language.Name = languageName;

                if (languages == null)
                {
                    languages = new List <LeanLanguage>();
                }

                languages.Add(language);
            }

            language.Cultures.Clear();
            language.Cultures.AddRange(cultures);

            return(language);
        }