Add TMs under each language pair and not under 'All Language Pairs'

Hello,

With the API I would like to add the TMs under each language combination and not under the 'All Language Pairs'

Any idea how to do this?

I've seen the following question but it got no replies in 3 years Slight smile

https://community.sdl.com/developers-more/developers/language-developers/f/sdk_qa/8281/adding-tms-on-the-language-pair-level

Thanks,

Pavlos

Parents
  • Hello , ,

    Sorry for the late response.

    We did what you provided but the TM we would like to add with the API is added under 'All Language pairs" and not under the 'English > Italian' language combination. See image below.

    Here is our code:

    TranslationProviderConfiguration translationProviderConfiguration = fileBasedProject.GetTranslationProviderConfiguration();

    TranslationProviderCascadeEntry translationProviderCascadeEntry = new TranslationProviderCascadeEntry(translationMemoryFilePath,true, true,false);

    translationProviderConfiguration.Entries.Add(translationProviderCascadeEntry);

    fileBasedProject.UpdateTranslationProviderConfiguration(new Language(CultureInfo.GetCultureInfo(targetLanguage)) , translationProviderConfiguration);

    Is there anything we miss?

  • Hi !

    From the picture it seems like the TM was added to English->Italian but that it was also added under All LPs.

    I retested the method for adding the TM to a specific LP and it works as expected. Are you sure that the TM wasn't already there before you did the addition?

  • Hello ,

    Initially we had one TM under the English > Italian lang. combination, and we would like to add a second TM there. Instead with the code you drafted the TM added under 'All language pairs' instead. That is why you see what you see in my image above.

  •  

    Yes, you're partially right. It doesn't add the TM under the specific LP if you try to add a new one but it doesn't add it to All LPs either for me. It just replaces the one that's already under the specifc LP. But anyway, I've found what will probably fix the issue. 

    When getting the config of the TPs add the target language for which you wish to add the TM:

         var config = project.GetTranslationProviderConfiguration(targetLanguage);

    Also, if you're modifying a new project, which doesn't have any TMs added under a specific LP, add this:

        config.OverrideParent = true;

Reply
  •  

    Yes, you're partially right. It doesn't add the TM under the specific LP if you try to add a new one but it doesn't add it to All LPs either for me. It just replaces the one that's already under the specifc LP. But anyway, I've found what will probably fix the issue. 

    When getting the config of the TPs add the target language for which you wish to add the TM:

         var config = project.GetTranslationProviderConfiguration(targetLanguage);

    Also, if you're modifying a new project, which doesn't have any TMs added under a specific LP, add this:

        config.OverrideParent = true;

Children
No Data