Export to tmx

Hi

I have small function to export files to tmx:

            TranslationMemoryExporter exporter = new TranslationMemoryExporter(tm.LanguageDirection);
            string f = tm.FilePath.Replace(System.IO.Path.GetFileName(tm.FilePath), System.IO.Path.GetFileNameWithoutExtension(tm.FilePath) + ".tmx");
            if(File.Exists(f)==true)File.Delete(f);
            exporter.Export(f, true);

I'm trying to find out how i can set up export filters. Does anyomne have any ideas how to do this?

Parents
  • I'd imagine it be something like the below. Check out "Exporting to a TMX File" in the

    Translation Automation API 2.1 (automation of the Translation Memory related task, Translation providers, etc.)

    manual page.

    public void RunFilteredExport(string tmPath, string exportFilePath)

    {

    #region "OpenForFilter"

    FileBasedTranslationMemory tm = new FileBasedTranslationMemory(tmPath);

    TranslationMemoryExporter exporter = new TranslationMemoryExporter(tm.LanguageDirection);

    #endregion

    #region "FilterDefinition"

    exporter.FilterExpression = this.GetFilterSimple();

    #endregion

    #region "DoFilteredExport"

    exporter.BatchExported += new EventHandler<BatchExportedEventArgs>(this.exporter_BatchExported);

    exporter.Export(exportFilePath, true);

    #endregion

    }

    private FilterExpression GetFilterSimple()

    {

    #region "SimpleCriterion"

    PicklistItem fieldName = new PicklistItem("Customer");

    MultiplePicklistFieldValue fieldValue = new MultiplePicklistFieldValue("Microsoft");

    fieldValue.Add(fieldName);

    #endregion

    #region "SimpleFilter"

    AtomicExpression filter = new AtomicExpression(fieldValue, AtomicExpression.Operator.Equal);

    return filter;

    #endregion

    }

Reply
  • I'd imagine it be something like the below. Check out "Exporting to a TMX File" in the

    Translation Automation API 2.1 (automation of the Translation Memory related task, Translation providers, etc.)

    manual page.

    public void RunFilteredExport(string tmPath, string exportFilePath)

    {

    #region "OpenForFilter"

    FileBasedTranslationMemory tm = new FileBasedTranslationMemory(tmPath);

    TranslationMemoryExporter exporter = new TranslationMemoryExporter(tm.LanguageDirection);

    #endregion

    #region "FilterDefinition"

    exporter.FilterExpression = this.GetFilterSimple();

    #endregion

    #region "DoFilteredExport"

    exporter.BatchExported += new EventHandler<BatchExportedEventArgs>(this.exporter_BatchExported);

    exporter.Export(exportFilePath, true);

    #endregion

    }

    private FilterExpression GetFilterSimple()

    {

    #region "SimpleCriterion"

    PicklistItem fieldName = new PicklistItem("Customer");

    MultiplePicklistFieldValue fieldValue = new MultiplePicklistFieldValue("Microsoft");

    fieldValue.Add(fieldName);

    #endregion

    #region "SimpleFilter"

    AtomicExpression filter = new AtomicExpression(fieldValue, AtomicExpression.Operator.Equal);

    return filter;

    #endregion

    }

Children
No Data