Beispiel #1
0
 public LocaleElement(string name, string language, string value)
 {
     if (LocaleElement.ValidateName(name) && LocaleElement.ValidateLanguage(language))
     {
         this.Name     = name;
         this.Language = language;
         this.Value    = value;
     }
 }
Beispiel #2
0
        /// <summary>
        /// Checks and returns parts
        /// </summary>
        /// <param name="text">text to parse</param>
        /// <param name="groupName">returned group name</param>
        /// <param name="name">returned locale name</param>
        /// <returns>true if well-formed</returns>
        public bool ExtractGroupAndName(string text, out string groupName, out string name)
        {
            groupName = "";
            name      = "";
            bool result = false;

            try
            {
                string[] split = text.Split('.');
                if (split.Length > 1)
                {
                    LocaleSystem.ValidateGroupName(split[0]);
                    LocaleElement.ValidateName(String.Join(".", split, 1, split.Length - 1));
                    groupName = split[0];
                    name      = String.Join(".", split, 1, split.Length - 1);
                    result    = true;
                }
            }
            catch { }
            return(result);
        }