Custom Terminology Provider - Cannot display language selection

I'm building a custom Terminology Provider and following the example in the ExcelTerminology sample project.

Once a terminology provider (i.e. termbase) has been selected, I should be able to map the termbase's languages to the project's languages...  but the termbase's languages never appear.

I suspect this is because there's something wrong with the termbase -  there is a red 'x' appearing adjacent to the termbase name once selected...

I've stepped through the code when a termbase gets selected and there are no exceptions, but I strongly suspect that between calling the constructor of my AbstractTerminologyProvider implementation and the GetLanguages method something is going wrong - the GetLanguages method is never called.

Here is the code which is called once the termbases have been browsed and selected...

My BridgeTerminologyProvider (referenced in the above code) has a constructor...

As can be seen, at the conclusion of this constructor I present a MessageBox showing the termbases's languages; this MessageBox is presented and contains the expected languages so I assume that everything has gone ok with this constructor. However, this is when the red 'x' appears next to the termbase's name (2nd image above).

I've also followed the documentation guide here, and the next step is to populate the GetLanguages method, but in my case GetLanguages is never called. So the process goes from my constructor - which appears to succeed - and never calls the subsequent method in the documentation. Perhaps there's something wrong with my implementation of ITerminologyProvider but no exceptions are thrown and the red 'x' doesn't have a tooltip offering an explanation.

I've F11'd my way through the code and upon leaving the TerminologyProviderWinFormsUI.Browse method (without any exceptions) the termbase name appears with a red 'x' and no languages are selectable.

What might be going wrong? What happens between TerminologyProviderWinFormsUI.Browse returning and ITerminologyProvider.GetLanguages being called?

Parents Reply Children
  • Hi Patrick,

    Thanks very much for the help. I'm now able to display search results as expected. However, the next problem occurs when the user double-clicks on a search result (or right-clicks and then selects "View term details"): I've created a UserControl which gets passed the expected object.

    [TerminologyProviderViewerWinFormsUI]
    public class TerminologyProviderViewerWinFormsUI : ITerminologyProviderViewerWinFormsUI
    {
        private TerminologyProvider _terminologyProvider;
        private TermsList _control;


        public Control Control
        {
            get
            {
                _control = new TermsList(_terminologyProvider)
                               {
                                   Text = @"TerminologyProviderViewerWinFormsUITermbaseBridge",
                                   BackColor = Color.White
                               };

                JumpToTermAction += _control.DisplayConcept;

                return _control;
            }
        }

        // code elided
    }

    The above method is called and returns my TermsList user control, as expected.

    The JumpToTermAction event is also invoked, as expected, and I can step through the code and see that the concept argument is as expected.

    public partial class TermsList : UserControl
    {
        public TermsList(TerminologyProvider provider)
        {
        }


        public void DisplayConcept(IEntry entry)
        {
            if (!(entry is Concept concept))
            {
                return;
            }

            label1 = new Label();
            label1.Text = concept.TermGroups.First(tg => tg.Language != null).Language.Code;

        // code elided
    }

    Screenshot of Trados Studio code showing the TermsList class with DisplayConcept method and a QuickWatch window displaying the 'entry' object properties.

    However, there are two things that puzzle me:

    1. I placed a Label control on the TermsList user control; in the DisplayConcept method this Label control is null.
      Following the documentation here I also tried to place a WebBrowser control onto the user control - again, when the method was called I found that the WebBrowser control was null.
      Why?
      DisplayConcept is not a static method, the user control has been instantiated, so why are its constituent controls not instantiated?

    2. Despite populating a new instance of a Label control in the above code snippet (as well as trying with a WebBrowser control) the Termbase Viewer panel is empty.
      It's as if the TermsList control that I'm working with is not the same instance which was instantiated by the TerminologyProviderViewerWinFormsUI class.

    Screenshot of Trados Studio's Termbase Viewer panel with an empty white space indicating no term details are displayed.



    Generated Image Alt-Text
    [edited by: Trados AI at 1:07 PM (GMT 0) on 5 Mar 2024]