/// <summary>Adds a group to translate. Returns 1 if it was ok.</summary>
        public int AddGroupFromFile(string targetPath, string sourcePath)
        {
            if (!File.Exists(sourcePath))
            {
                return(2);
            }

            // Read the source text:
            string sourceText = File.ReadAllText(sourcePath);

            // And parse it into a language set (of variables):
            LanguageGroup source = new LanguageGroup(sourceText);

            if (source.Count == 0)
            {
                return(3);
            }

            AddGroup(targetPath, source);
            return(1);
        }
Beispiel #2
0
        /// <summary>Called when this tag is all loaded and ready to go.</summary>
        public override void OnChildrenLoaded()
        {
            string name = this["name"];

            if (name == null)
            {
                return;
            }

            // Get the group:
            LanguageGroup g = group;

            if (g == null)
            {
                // Got a var inside all.xml - ignore it.
                return;
            }

            // Get the gender:
            string gender = this["gender"];

            if (gender != null)
            {
                gender = gender.Trim().ToLower();
            }

            if (gender == "boy" || gender == "male")
            {
                name += " gender:b";
            }
            else if (gender == "girl" || gender == "female")
            {
                name += " gender:g";
            }

            // Set the value now:
            g.SetValue(name, firstChild.textContent);
        }