Example #1
0
        public void AddGroup(LocalizationGroup group)
        {
            var list = ChildGroups.ToList();

            list.Add(group);
            ChildGroups = list.ToArray();
        }
        public static void Main(string[] args)
        {
            try
            {
                if (Languages.Count() == 0 || SourceFiles.Count() == 0 || DestPath == string.Empty)
                {
                    return;
                }

                var mergedTranslations = new List <XML.LocalizationGroup>();
                foreach (var language in Languages)
                {
                    var group = new XML.LocalizationGroup(language.Name);
                    foreach (string file in SourceFiles)
                    {
                        var originalFile = GetTranslations(file);
                        if (originalFile != null)
                        {
                            group.AddItems(originalFile);
                        }

                        var translatedFile = GetTranslations(Path.GetDirectoryName(file) + @"\" + Path.GetFileNameWithoutExtension(file) + GetSourceFileSeparator(file) + language.FileName + Path.GetExtension(file));
                        if (translatedFile != null)
                        {
                            group.AddItems(translatedFile);
                        }
                    }
                    mergedTranslations.Add(group);
                }

                var staticTexts = new XML.StaticTexts();
                staticTexts.Localization = mergedTranslations.ToArray();
                SaveTranslations(staticTexts, DestPath);
                Log.GravarLog(string.Format("Processamento XML concluĂ­do com sucesso. Arquivo de destino: '{0}'.", System.IO.Path.GetFullPath(DestPath)));
            }
            catch (Exception ex)
            {
                Log.GravarLog(string.Format("Ocorreu um erro no processamento do arquivo. Erro: {0}. StackTrace: {1}", ex.Message, ex.StackTrace));
            }
        }