About x-Context in the TMX file.

Hi!
 
I'm creating a tool that works as the following using Translation Memory API.

(1)create an empty memory.
(2)Import a sdlxliff file to the memory.
(3)export the memory to a tmx file.

My code is the following.

        public void CreateFileBasedTM(string XLIFFPath)
        {
            string TMPath = this.CreateTMPath(XLIFFPath);

            FileBasedTranslationMemory tm = new FileBasedTranslationMemory(
                TMPath,
                "This is a TM from COMICS SDLXLIFF.",
                CultureInfo.GetCultureInfo(src_lang),
                CultureInfo.GetCultureInfo(tgt_lang),
                this.GetFuzzyIndexes(),
                this.GetRecognizers());
           
            tm.LanguageResourceBundles.Clear();

            tm.Save();

            // TM import.
            TranslationMemoryImporter importer = new TranslationMemoryImporter(tm.LanguageDirection);
            this.GetImportSettings(importer.ImportSettings);
            importer.Import(XLIFFPath);
        }

        // get fuzzy indexes
        private FuzzyIndexes GetFuzzyIndexes()
        {
            return FuzzyIndexes.SourceCharacterBased |
                FuzzyIndexes.SourceWordBased |
                FuzzyIndexes.TargetCharacterBased |
                FuzzyIndexes.TargetWordBased;
        }

        // get recognizers
        private BuiltinRecognizers GetRecognizers()
        {
            return BuiltinRecognizers.RecognizeAll;
        }

        //  Configure the import settings.
        private void GetImportSettings(ImportSettings importSettings)
        {
            ConfirmationLevel[] levels = {ConfirmationLevel.Draft,ConfirmationLevel.Translated, 
                                          ConfirmationLevel.RejectedTranslation,ConfirmationLevel.ApprovedTranslation,
                                          ConfirmationLevel.RejectedSignOff,ConfirmationLevel.ApprovedSignOff};
            importSettings.ConfirmationLevels = levels;
            importSettings.PlainText = false;
            importSettings.CheckMatchingSublanguages = false;
            importSettings.ExistingFieldsUpdateMode = ImportSettings.FieldUpdateMode.Overwrite;
            importSettings.ExistingTUsUpdateMode = ImportSettings.TUUpdateMode.AddNew;
        }
        public void ExportTMXFile(string TMPath)
        {
            string TMXPath =  this.CreateTMXPath(TMPath);

            FileBasedTranslationMemory tm = new FileBasedTranslationMemory(TMPath);
            TranslationMemoryExporter exporter = new TranslationMemoryExporter(tm.LanguageDirection);
            exporter.Export(TMXPath, true);

        }

 

I found that there is no <prop type="x-Context"> tag in the tu tag in the exported TMX file.

How  to export  <prop type="x-Context"> tag to the TMX file?

Thanks.

Parents Reply Children
No Data