/// <summary>
        /// The constructor creates the translation memory
        /// Adds the project's source and target languages to the TM
        /// Creates the core directory structure (if not present)
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="projectFile"></param>
        public FileReader(TMBatchTaskSettings settings, ProjectFile projectFile, ref BatchTaskLogger logger)
        {
            // Note: This is not currently in use. Marked for potential deletion
            //this._taskSettings = settings;
            //this._inputFilePath = projectFile.LocalFilePath;

            this.referenceNumbers = new List <string>();
            this.tmDetails        = new TMDetails();

            this.logger = logger;

            // Setting up language abbreviations in the TM details class
            tmDetails.SourceLanguage = projectFile.SourceFile.Language.CultureInfo;
            tmDetails.TargetLanguage = projectFile.Language.CultureInfo;

            // Creating a new folder structure for the translation memory
            string        dirPath      = Path.GetDirectoryName(projectFile.LocalFilePath);
            string        fileName     = Path.GetFileNameWithoutExtension(projectFile.LocalFilePath);
            DirectoryInfo sdltmDir     = Directory.CreateDirectory($"{dirPath}\\TranslationMemories\\{fileName}");
            DirectoryInfo tmxDirectory = Directory.CreateDirectory($"{sdltmDir.FullName}\\Exports");

            tmxDir = $"{tmxDirectory.FullName}\\{fileName}.tmx";
            // Creating a translation memory
            TMCreator objCreate = new TMCreator();

            tm = objCreate.CreateFileBasedTM($"{sdltmDir.FullName}\\{Utility.RandomString(10)}.sdltm",
                                             projectFile.SourceFile.Language.CultureInfo, projectFile.Language.CultureInfo);
        }
Ejemplo n.º 2
0
        protected override void ConfigureConverter(ProjectFile projectFile, IMultiFileConverter multiFileConverter)
        {
            // Creating a new FileReader and giving it access to the settings (unneeded currently) and the file; parsing text afterwards
            // The FileReader handles the task logic of searching the reference numbers, creating and populating the translation memory
            // And providing the reference numbers back

            logger = new BatchTaskLogger(Path.GetDirectoryName(projectFile.LocalFilePath), LoggingLevels.DEBUG);

            task = new FileReader(_settings, projectFile, ref logger);
            multiFileConverter.AddBilingualProcessor(task);
            multiFileConverter.Parse();
        }