public Dictionary <string, XliffTranslationFiles> GetXliffFilesPerLocale()
        {
            var files = new Dictionary <string, XliffTranslationFiles>();

            foreach (var document in xlfDocuments)
            {
                string xliffFilePath = XliffFileHelpers.GetRelativeFilePathTo(baseDirectory, document.FileName);
                string plainFileName = XliffFileHelpers.GetPlainFileName(baseDirectory, xliffFilePath);

                foreach (var xlfFile in document.Files)
                {
                    string storageLocation = XliffFileHelpers.GetStorageLocation(plainFileName, xlfFile.Original);
                    string locale          = XliffFileHelpers.ExtractLocaleFromFileName(xliffFilePath);

                    if (!files.TryGetValue(storageLocation, out XliffTranslationFiles translationFiles))
                    {
                        translationFiles = new XliffTranslationFiles(storageLocation);
                        files.Add(storageLocation, translationFiles);
                    }

                    translationFiles.AddXliffFile(locale, xlfFile);
                }
            }

            return(files);
        }
        public void SaveDocuments(IEnumerable <string> localesToSave)
        {
            foreach (var document in xlfDocuments)
            {
                string xliffFilePath = XliffFileHelpers.GetRelativeFilePathTo(baseDirectory, document.FileName);
                string plainFileName = XliffFileHelpers.GetPlainFileName(baseDirectory, xliffFilePath);
                string locale        = XliffFileHelpers.ExtractLocaleFromFileName(xliffFilePath);

                if (!localesToSave.Contains(locale))
                {
                    continue;
                }

                try
                {
                    document.Save();
                    savedXlfDocuments.Add(document);
                }
                catch (Exception ex)
                {
                    fileSaveErrors.Add(new XliffFileError(document.FileName, ex));
                }
            }
        }