/// <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); }
protected override void OnInitializeTask() { // Note: there are no settings currently, only a template of them if needed _settings = GetSetting <TMBatchTaskSettings>(); }