Adding Termbase in project wont work because of name

We add the correct termbases to our project upon job creation via the API, but translators always have to remove the termbase and add it again when they receive the packages because the termbase we add turns up with a red icon under termbases in project setting in Studio.

After checking it turns out the name of the termbase, as specified in the project file:
  <TermbaseConfiguration>
    <Termbases>
      <Name>This_is_our_termbase_FILE_name</Name>

Is not the actual termbase name, but the file name for the termbase without the extension.

If we change this to the real name of the termbase (by simply editing in notepad) the termbase pops up just fine in studio.

Is there anywhere we can set this name in the API? I thought it just used the name defined in the Termbase we reference but apparently its not so. The only name property I can find is read only and in the sample code the termbase name is not set explicitly either.

Id be thankful for any hints on how to solve this.

  • I have the same problem here. Does anyone have an answer for this problem?

  • I also had this problem (though I didn't realize it at first). Sorry, no answers short of editing the .sdlproj file. I'm just replying to show SDL that this is still a problem.

  • Thank you! I was stuck for a while trying to figure out why I was getting a NullReferenceException. It just so happened some of my Termbases had a different termbase name in their definition from the physical path name.
  • In case it helps: In our context, we create projects with the API using templates. We just add in advance the MultiTerm termbases to the project templates so that all new projects will have the correct termbase.

    Not sure if that would work on your side and it does not address the problem itself but it might work as a workaround.

    Daniel
  • Hi
    When you create term base "Friendly name" must match actual file name (without extension).

    Then if you add this termbase to the project with code like this:
    private static void UpdateTermbases(FileBasedProject p, TradosWorkQueue q, ProjectInfo info)
    {
    try
    {
    TradosMultiterm MT = new TradosMultiterm();
    MT.JobID = q.JobId;
    MT.LanguageID = q.LanguageId;
    DataTable dt = MT.GetLanguageMultiterms();
    if (dt.Rows.Count > 0)
    {
    TermbaseConfiguration termbase = p.GetTermbaseConfiguration();
    TermbaseLanguageIndex item = new TermbaseLanguageIndex(info.SourceLanguage, "source");
    TermbaseLanguageIndex item2 = new TermbaseLanguageIndex(info.TargetLanguages[0], "target");
    termbase.LanguageIndexes.Add(item);
    termbase.LanguageIndexes.Add(item2);
    TermRecognitionOptions trboptions = new TermRecognitionOptions();

    trboptions.MinimumMatchValue = q.TBMinimumMatchValue.Value;
    trboptions.SearchDepth = q.TBSearchDepth.Value;
    if (q.TermbaseSearch == TermbaseSearchOrder.TBSearch1)
    {
    trboptions.SearchOrder = Sdl.ProjectAutomation.Core.TermbaseSearchOrder.Hierarchical;
    }
    else if (q.TermbaseSearch == TermbaseSearchOrder.TBSearch2)
    {
    trboptions.SearchOrder = Sdl.ProjectAutomation.Core.TermbaseSearchOrder.Parallel;
    }
    else
    {
    trboptions.SearchOrder = Sdl.ProjectAutomation.Core.TermbaseSearchOrder.Sequential;
    }
    trboptions.ShowWithNoAvailableTranslation = q.TBShowRecognizedTermsWithNoAvailableTranslation.Value;
    termbase.TermRecognitionOptions = trboptions;

    foreach (DataRow row in dt.Rows)
    {
    Termbase tmb = new LocalTermbase(row[MT.cnst_trados_multiterm_file].ToString());

    tmb.Enabled = true;
    termbase.Termbases.Add(tmb);
    }



    p.UpdateTermbaseConfiguration(termbase);
    }
    }
    catch (Exception ex)
    {

    throw ex;
    }

    }

    It will work perfectly.
    Also source index column must be named "source" and target index column must be named "target".

    However, you can actually get source and target indexes using MultitermAPI:
    (just small example):
    private void Button_Click(object sender, RoutedEventArgs e)
    {
    MultiTermIX.Application mt = new MultiTermIX.Application();
    TermbaseRepository rep = mt.LocalRepository;
    rep.Connect("", "");
    Termbases tbs = rep.Termbases;
    string tb = @"C:\termbasetest\New Termbase111.sdltb";
    tbs.New("test", "test",
    @"C:\termbasetest\TrainingWill Yao.xdt",
    tb);
    MultiTermIX.Termbase tbase = tbs[tb];


    foreach (Index ind in tbase.Definition.Indexes)
    {
    MessageBox.Show(ind.Language);
    }
    MessageBox.Show(tbase.Entries.Count.ToString());
    tbase.Close();
    }

    Hope this is what you are looking for....