Remove programmatically all termbases from a project

Dear users,

In SDL Studio 2014, I need to implement a function which removes all termbases from a project.

I tried to overwrite the current List with an empty one. 

TermbaseConfiguration termbaseConfig = project.GetTermbaseConfiguration();

int tbCount = termbaseConfig.Termbases.Count;

if (tbCount > 0)

{

   termbaseConfig.Termbases = new List<Termbase>();

 

   project.UpdateTermbaseConfiguration(termbaseConfig);

}

 

However, I get the runtime argument exception "No termbases have been specified." when the UpdateTermbaseConfiguration method is invoked. It seems that the configuration requires at least one termbase to work properly.

Any suggestion would be appreciated.

Parents
  • Looking at project file of a project without termbase configured I deduce that it needs to have at least some basic termbase options configured:

      <TermbaseConfiguration>
        <LanguageIndexMappings>
          <Language>en-US</Language>
        </LanguageIndexMappings>
        <LanguageIndexMappings>
          <Language>de-DE</Language>
        </LanguageIndexMappings>
        <LanguageIndexMappings>
          <Language>fr-FR</Language>
        </LanguageIndexMappings>
        <RecognitionOptions>
          <ShowWithNoAvailableTranslation>false</ShowWithNoAvailableTranslation>
          <MinimumMatchValue>70</MinimumMatchValue>
          <SearchDepth>200</SearchDepth>
          <SearchOrder>Parallel</SearchOrder>
        </RecognitionOptions>
      </TermbaseConfiguration>

  • Dear Evzen, thank you for your remark.
    The TermbaseConfiguration object has indeed two properties "LanguageIndexes" and "TermRecognitionOptions" which appear to be serialized in your snippet.
    In my code, though, I do not access (or modify) them, so they should remain as they were before.

    Besides, I have tested resetting them too (like I do for the Termbases property), but this does not solve the issue either.
Reply Children