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>

Reply
  • 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>

Children