Has setting ITerminologyProvider.ActiveFilter any impact?

There is a new Terminology Provider API since Studio 2022 SR2 and I was quite excited when I saw that it now should be possible to manage Filters (see how-to-update-plugins-to-trados-studio-2022-sr2)

When I change the value in the UI it is reflected in the ActiveFilter property.

However, setting ActiveFilter programmatically seems to have no impact at all: It doesn't change the Filter value in the UI and it is not saved with the project.

Can anybody confirm this?

I tested this with Trados Studio 2022 SR2 - 17.2.11.19134 using a homegrown Terminology Provider (not MultiTerm)



Studio version added
[edited by: Angela Sigee at 3:07 PM (GMT 0) on 2 Dec 2024]
Parents
  •  

    The ActiveFilter property is intended to capture input from users. When a user selects a filter through the UI, the search functionality can then operate based on that selection.

    However, if it is necessary to modify this property programmatically, here is an example of how to do so:

    [Action(nameof(DevTestAction), Name = "Change active filter")]
    [ActionLayout(typeof(DevTest), 10, DisplayType.Large)]
    public class DevTestAction : AbstractAction
    {
        protected override void Execute()
        {
            var projectController = SdlTradosStudio.Application?.GetController<ProjectsController>();
            var fileBasedProject = projectController.SelectedProjects.First();
    
            var tbSettings = fileBasedProject.GetTermbaseConfiguration();
            tbSettings.Termbases.First(tb => tb.Name == "termbaseName").FilterName = "filterName";
    
            var path = GetPathFromTermbaseSettingsXml(tbSettings.Termbases.First().SettingsXML);
            tbSettings.TermbaseServerUri = new Uri(path);
    
            fileBasedProject.UpdateTermbaseConfiguration(tbSettings);
        }
    
        public static string GetPathFromTermbaseSettingsXml(string xml)
        {
            var doc = XDocument.Parse(xml);
            var pathElement = doc.Descendants("Path").FirstOrDefault();
            return pathElement?.Value;
        }
    }

    There is a bug in Studio that prevents updating the termbase configuration settings unless a TermbaseServerUri is first provided. For file-based terminology providers, this corresponds to the path of the terminology file. This requirement is why the additional call to the GetPathFromTermbaseSettingsXml method is necessary. An item will be created for the Studio team to address this issue so that, in the future, the settings can be updated more easily.

    If this does not resolve the issue, please provide additional details about your scenario so we can offer a more targeted solution.

  •  

    Thanks, that looks promising. I'll give it a go when I'm back from my holidays

Reply Children
No Data